diff options
Diffstat (limited to 'layouts/partials/head')
| -rw-r--r-- | layouts/partials/head/index.html | 2 | ||||
| -rw-r--r-- | layouts/partials/head/meta.html | 42 | ||||
| -rw-r--r-- | layouts/partials/head/styles.html | 22 |
3 files changed, 46 insertions, 20 deletions
diff --git a/layouts/partials/head/index.html b/layouts/partials/head/index.html new file mode 100644 index 0000000..eb096b8 --- /dev/null +++ b/layouts/partials/head/index.html @@ -0,0 +1,2 @@ +{{- partial "head/meta" . -}} +{{- partial "head/styles" . -}} diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html index 23a770a..329d9bf 100644 --- a/layouts/partials/head/meta.html +++ b/layouts/partials/head/meta.html @@ -1,12 +1,32 @@ -<meta charset="UTF-8"> -<meta http-equiv="X-UA-Compatible" content="IE=edge"> -<meta name="viewport" content="width=device-width, initial-scale=1.0"> +{{ $favicon := resources.GetMatch .Site.Params.favicon }} + +<meta charset="UTF-8" /> +<meta http-equiv="X-UA-Compatible" content="IE=edge" /> +<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }}{{ end }}</title> -<meta name="description" - content="{{ if .IsPage }}{{ or .Params.description .Summary }}{{ else if .IsHome }}{{ .Site.Params.description }}{{ else if .IsNode }}{{ or .Params.description .Summary }}{{ end }}"> -<link rel="canonical" href="{{ .Permalink }}"> -<link rel="robots" href="/robots.txt" /> -{{ with .OutputFormats.Get "rss" -}} -{{ printf ` -<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink site.Title | safeHTML }} -{{ end }}
\ No newline at end of file +<meta + name="description" + content="{{ if .IsPage }}{{ or .Params.description .Summary }}{{ else if .IsHome }}{{ .Site.Params.description }}{{ else if .IsNode }}{{ or .Params.description .Summary }}{{ end }}" +/> +<link rel="canonical" href="{{ .Permalink }}" /> +<link rel="robots" href="/robot.txt" /> + +<link rel="icon" type="image/x-icon" href="{{ $favicon.RelPermalink }}" /> + +{{ if .Site.Config.Services.GoogleAnalytics.ID }} +<!-- Google Analytics --> +<script + defer + src="https://www.googletagmanager.com/gtag/js?id={{ .Site.Config.Services.GoogleAnalytics.ID }}" +></script> +<script> + window.dataLayer = window.dataLayer || []; + function gtag() { + dataLayer.push(arguments); + } + gtag('js', new Date()); + + gtag('config', '{{ .Site.Config.Services.GoogleAnalytics.ID }}'); +</script> +<!-- End Google Analytics --> +{{ end }} diff --git a/layouts/partials/head/styles.html b/layouts/partials/head/styles.html index 68577ce..cfab45a 100644 --- a/layouts/partials/head/styles.html +++ b/layouts/partials/head/styles.html @@ -1,13 +1,17 @@ -{{/* Resources */}} -{{- $tailwind := resources.Get "css/tailwind.css" | postCSS (dict "config" "./config/postcss.config.js") -}} +{{/* Resources */}} +{{- $tailwind := resources.Get "css/tailwind.css" | postCSS (dict "config" "./config/postcss.config.js") -}} -{{/* Processor */}} -{{- $styles := slice $tailwind | resources.Concat "css/app.css" -}} +{{/* MathJax */}} +<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> +<script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ['\\(','\\)']] } });</script> -{{/* Output */}} +{{/* Processor */}} +{{- $styles := slice $tailwind | resources.Concat "css/app.css" -}} + +{{/* Output */}} {{- if eq hugo.Environment "development" -}} -<link rel="stylesheet" href="{{ $styles.Permalink | absURL }}"> -{{- else -}} -{{- $styles := $styles | minify | fingerprint | resources.PostProcess -}} -<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" > + <link rel="stylesheet" href="{{ $styles.Permalink | absURL }}" /> +{{- else -}} + {{- $styles := $styles | minify | fingerprint | resources.PostProcess -}} + <link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" /> {{- end -}} |
