diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..3b8c6e5 --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,64 @@ + + + {{- .Site.Title }} + {{- if not hugo.IsProduction }} + + {{- end }} + + + + + + + + + {{ block "head/favicon" . }}{{ partialCached "head/favicon.html" . }}{{ end }} + + {{- partial "google-fonts" . }} + + {{ template "_internal/opengraph.html" . }} + + {{- $options := dict "enableSourceMap" true }} + {{- if hugo.IsProduction}} + {{- $options := dict "enableSourceMap" false "outputStyle" "compressed" }} + {{- end }} + {{- $style := resources.Get "/scss/style.scss" }} + {{- $style = $style | resources.ExecuteAsTemplate "/scss/style.scss" . | resources.ToCSS $options }} + {{- if hugo.IsProduction }} + {{- $style = $style | minify | fingerprint "sha384" }} + {{- end -}} + + + {{ $js := resources.Get "js/bootstrap.js" }} + {{ $params := dict }} + {{ $sourceMap := cond hugo.IsProduction "" "inline" }} + {{ $opts := dict "sourceMap" $sourceMap "minify" hugo.IsProduction "target" "es2018" "params" $params }} + {{ $js = $js | js.Build $opts }} + {{ if hugo.IsProduction }} + {{ $js = $js | fingerprint "sha384" }} + {{ end }} + + + {{ if .Site.Data.landing.image_compare.enable }} + {{ $imagecompare := resources.Get "js/image-compare-viewer.min.js" }} + {{- if not .Site.IsServer }} + {{- $js := (slice $imagecompare) | resources.Concat "/js/image-compare.js" | minify | fingerprint "sha384" }} + + {{- else }} + {{- $js := (slice $imagecompare) | resources.Concat "/js/image-compare.js" }} + + {{- end }} + {{- end }} + + {{- if not .Site.IsServer }} + {{ if and (.Site.Params.plausible.scriptURL) (.Site.Params.plausible.dataDomain) -}} + {{- partialCached "head/plausible" . }} + {{- end -}} + {{- end -}} + + {{- if not .Site.IsServer }} + {{- if .Site.GoogleAnalytics }} + {{- template "_internal/google_analytics.html" . -}} + {{- end -}} + {{- end -}} +