diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 0ac3ced608..921d87389c 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,11 +1,5 @@ -{{/* Adapted from Docsy; changes are to Google Analytics */}} -{{/* OK to remove once using a modern enough Docsy (eg 0.11.0 or later) */}} - - -{{ hugo.Generator }} -{{ range .AlternativeOutputFormats -}} - -{{ end -}} +{{- $isBlogPost := eq .Section "blog" }} +{{- $ogType := cond (.IsHome) "website" "article" }} {{ $outputFormat := partial "outputformat.html" . -}} {{ if and hugo.IsProduction (ne $outputFormat "print") -}} @@ -14,38 +8,80 @@ {{ end -}} + +{{ range .Translations -}} + +{{ end -}} + + + + +{{ hugo.Generator }} +{{ range .AlternativeOutputFormats -}} + +{{ end -}} {{ partialCached "favicons.html" . }} - - {{- if .IsHome -}} - {{ .Site.Title -}} - {{ else -}} - {{ with .Title }}{{ . }} | {{ end -}} - {{ .Site.Title -}} - {{ end -}} - +{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }} +{{- template "_internal/opengraph.html" . -}} +{{- template "_internal/schema.html" . -}} +{{- template "_internal/twitter_cards.html" . -}} +{{- if hugo.IsProduction -}} +{{ template "_internal/google_analytics.html" . }} +{{ end }} +{{ partialCached "head-css.html" . "asdf" }} +{{ if and (.Site.Params.offlineSearch) (not .Site.Params.gcs_engine_id) }} + + +{{end}} + + + + + +{{ partial "css.html" . }} + + -{{ template "_internal/opengraph.html" . -}} -{{ template "_internal/schema.html" . -}} -{{ template "_internal/twitter_cards.html" . -}} -{{ partialCached "head-css.html" . "asdf" -}} - -{{ if .Site.Params.offlineSearch -}} - -{{ end -}} + + + + + + + + +{{ if $isBlogPost }} +{{ with findRE "" .Content 1 }} + +{{ end }} +{{ else }} + +{{ end }} + -{{ if .Site.Params.prism_syntax_highlighting -}} - -{{ end -}} + + + -{{ partial "hooks/head-end.html" . -}} +{{- if eq (lower .Params.cid) "community" -}} + +{{- end -}} +{{ with .Params.js }}{{ range (split . ",") }} +{{ end }}{{ else }}{{ end }} -{{/* To comply with GDPR, cookie consent scripts places in head-end must execute before Google Analytics is enabled */ -}} -{{ if hugo.IsProduction -}} - {{ template "_internal/google_analytics.html" . }} -{{ end -}} +{{/* make sure that head-end hook comes last */}} +{{ partial "hooks/head-end.html" . }} diff --git a/layouts/partials/hooks/head-end.html b/layouts/partials/hooks/head-end.html index 17090c1afb..1b48f6627c 100644 --- a/layouts/partials/hooks/head-end.html +++ b/layouts/partials/hooks/head-end.html @@ -1,40 +1,3 @@ -{{/* reference page-specific open graph image */}} -{{- if ( eq .Section "blog" ) -}} -{{ with findRE "" .Content 1 }} - -{{ end }} -{{- else -}} -{{- with resources.Get "images/kubernetes-horizontal-color.png" -}} -{{- with resources.Copy "images/kubernetes-open-graph.png" . -}} - -{{- else -}} -{{- warnf "No image. Boo." -}} -{{- end -}} -{{- end -}} -{{- end -}} - - -{{ range .Translations -}} - -{{ end -}} - - - - {{- if or (.HasShortcode "table") (.HasShortcode "feature-gate-table") -}} @@ -92,9 +55,3 @@ {{- if or (.HasShortcode "code_sample") (.HasShortcode "code") (.HasShortcode "codenew") -}} {{- end -}} - -{{- if eq (lower .Params.cid) "community" -}} - -{{- end -}} -{{ with .Params.js }}{{ range (split . ",") }} -{{ end }}{{ else }}{{ end }} diff --git a/assets/images/kubernetes-horizontal-color.png b/static/images/kubernetes-horizontal-color.png similarity index 100% rename from assets/images/kubernetes-horizontal-color.png rename to static/images/kubernetes-horizontal-color.png