diff options
Diffstat (limited to 'layouts/partials/head.html')
-rw-r--r-- | layouts/partials/head.html | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..e92dc9e --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,72 @@ +<head> + {{ if eq hugo.Environment "production" -}} + {{ if site.GoogleAnalytics }} + <!-- Google Analytics shall work only on production website --> + <!-- prefetch --> + <link rel="dns-prefetch" href="https://www.googletagmanager.com/"> + <link rel="preconnect" href="https://www.googletagmanager.com/" crossorigin> + <link rel="dns-prefetch" href="https://www.google-analytics.com/"> + <link rel="preconnect" href="https://www.google-analytics.com/" crossorigin> + + {{ if and (eq site.Params.cookieConsent.switch "on") (eq site.Params.cookieConsent.type "opt-in") }} + <script> + // Disable tracking by default + window[{{ printf "%s%s" "ga-disable-" site.GoogleAnalytics }}] = true; + </script> + {{ end }} + + {{ if ne site.Params.userExperience.googleAnalyticsLoading "async" }} + {{ template "_internal/google_analytics.html" . }} + {{ else }} + {{ template "_internal/google_analytics_async.html" . }} + {{ end }} + {{ end }} + {{ if ne site.Params.seo.switch "off" }} + <!-- SEO tag --> + {{- partial "seo.html" . -}} + {{ end }} + <!-- Hugo's Tag shall work only on production website --> + {{ hugo.Generator }} + {{- else }} + {{ if ne site.Params.seo.switch "off" }} + <!-- SEO tag --> + {{- partial "seo.html" . -}} + {{ end }} + {{- end }} + + <!-- Minified Aggregated CSS --> + {{- $css := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "/assets/css/main.scss" . | toCSS | minify | fingerprint }} + <!-- Run PostCSS on $css, only if on Production Environment, since its builds take considerably more time --> + {{ if eq hugo.Environment "production" -}} + {{- $css = $css | postCSS | fingerprint | resources.PostProcess }} + {{- else }} + {{- $css = $css | fingerprint }} + {{- end }} + + <link rel="stylesheet" href="{{ $css.RelPermalink }}" integrity="{{ $css.Data.Integrity }}" crossorigin="anonymous"> + <!-- Prefetch and Preconnect Google Fonts API --> + <link rel="dns-prefetch" href="//fonts.googleapis.com"> + <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin> + + <!-- AMP, RSS Feed, and other output formats --> + {{- range .AlternativeOutputFormats -}} + {{- printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink site.Title | safeHTML }} + {{- end -}} + + {{ if site.Params.faviconTags }} + {{ site.Params.faviconTags | safeHTML }} + {{ end }} + + <!-- Address bar color --> + <!-- Chrome, Firefox OS and Opera --> + <meta name="theme-color" content="#fff6f8"> + <!-- Windows Phone --> + <meta name="msapplication-navbutton-color" content="#fff6f8"> + <!-- iOS Safari --> + <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> + + {{ if site.Params.customVerification.myWOT }} + <!-- WOT Verification --> + <meta name="wot-verification" content="{{ site.Params.customVerification.myWOT }}" /> + {{ end }} +</head> |