Revert "Tidy <head> for pages"

This commit is contained in:
Tim Bannister 2025-01-27 14:11:20 +00:00 committed by GitHub
parent d806c5a54f
commit 41cdaf5330
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 74 additions and 81 deletions

View File

@ -1,11 +1,5 @@
{{/* Adapted from Docsy; changes are to Google Analytics */}} {{- $isBlogPost := eq .Section "blog" }}
{{/* OK to remove once using a modern enough Docsy (eg 0.11.0 or later) */}} {{- $ogType := cond (.IsHome) "website" "article" }}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{{ hugo.Generator }}
{{ range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end -}}
{{ $outputFormat := partial "outputformat.html" . -}} {{ $outputFormat := partial "outputformat.html" . -}}
{{ if and hugo.IsProduction (ne $outputFormat "print") -}} {{ if and hugo.IsProduction (ne $outputFormat "print") -}}
@ -14,38 +8,80 @@
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
{{ end -}} {{ end -}}
<!-- alternative translations -->
{{ range .Translations -}}
<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}">
{{ end -}}
<!-- Docsy head.html begins here -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{{ hugo.Generator }}
{{ range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end -}}
{{ partialCached "favicons.html" . }} {{ partialCached "favicons.html" . }}
<title> <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title>
{{- if .IsHome -}} {{- template "_internal/opengraph.html" . -}}
{{ .Site.Title -}} {{- template "_internal/schema.html" . -}}
{{ else -}} {{- template "_internal/twitter_cards.html" . -}}
{{ with .Title }}{{ . }} | {{ end -}} {{- if hugo.IsProduction -}}
{{ .Site.Title -}} {{ template "_internal/google_analytics.html" . }}
{{ end -}} {{ end }}
</title> {{ partialCached "head-css.html" . "asdf" }}
{{ if and (.Site.Params.offlineSearch) (not .Site.Params.gcs_engine_id) }}
<script src="https://unpkg.com/lunr@2.1.6/lunr.js"></script>
<script src="/js/offline-search.js"></script>
{{end}}
<!-- Docsy head.html ends here -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"url": "https://kubernetes.io",
"logo": "https://kubernetes.io/images/favicon.png",
{{- if not .Site.Params.deprecated }}
"potentialAction": {
"@type": "SearchAction",
"target": {{ printf "%s%s" ("search/" | absURL) "?q={search_term_string}" }},
"query-input": "required name=search_term_string"
}
{{ end }}
}
</script>
<meta name="theme-color" content="#326ce5">
{{ partial "css.html" . }}
<!-- Content for social media sharing previews -->
<!-- Facebook uses the og: stuff, while Twitter and others use twitter: -->
<meta name="description" content="{{ template "partials/page-description.html" . }}"> <meta name="description" content="{{ template "partials/page-description.html" . }}">
{{ template "_internal/opengraph.html" . -}} <meta property="og:description" content="{{ template "partials/page-description.html" . }}">
{{ template "_internal/schema.html" . -}} <meta name="twitter:description" content="{{ template "partials/page-description.html" . }}">
{{ template "_internal/twitter_cards.html" . -}} <meta property="og:url" content="{{ .Permalink }}">
{{ partialCached "head-css.html" . "asdf" -}} <meta property="og:title" content="{{ if .Params.title }}{{ .Title }}{{ else }}{{ .Summary | truncate 10 }}{{ end }}">
<script <meta name="twitter:title" content="{{ if .Params.title }}{{ .Title }}{{ else }}{{ .Summary | truncate 10 }}{{ end }}">
src="https://code.jquery.com/jquery-3.6.0.min.js" <meta name="twitter:image" content="https://kubernetes.io/images/favicon.png" />
integrity="sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK" <!-- Alt text for the site image -->
crossorigin="anonymous"></script> <meta name="twitter:image:alt" content="{{ site.Title }}">
{{ if .Site.Params.offlineSearch -}} {{ if $isBlogPost }}
<script defer {{ with findRE "<img.*?>" .Content 1 }}
src="https://unpkg.com/lunr@2.3.9/lunr.min.js" <meta property="og:image" content="{{ index . 0 | replaceRE ".*src=\"(.+?)\".*" "$1" }}">
integrity="sha384-203J0SNzyqHby3iU6hzvzltrWi/M41wOP5Gu+BiJMz5nwKykbkUx8Kp7iti0Lpli" {{ end }}
crossorigin="anonymous"></script> {{ else }}
{{ end -}} <meta property="og:image" content="{{ "/images/kubernetes-horizontal-color.png" | relURL }}">
{{ end }}
<meta property="og:type" content="{{ $ogType }}">
{{ if .Site.Params.prism_syntax_highlighting -}} <script src="/js/jquery-3.6.0.min.js" intregrity="sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK" crossorigin="anonymous"></script>
<link rel="stylesheet" href="{{ "css/prism.css" | relURL }}"/> <!--script src="https://unpkg.com/split.js/dist/split.min.js"></script-->
{{ end -}} <script src="/js/split-1.6.0.js" intregrity="sha384-0blL3GqHy6+9fw0cyY2Aoiwg4onHAtslAs4OkqZY7UQBrR65/K4gI+hxLdWDrjpz"></script>
{{ partial "hooks/head-end.html" . -}} {{- if eq (lower .Params.cid) "community" -}}
<script defer src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
{{- end -}}
{{ with .Params.js }}{{ range (split . ",") }}<script src="{{ (trim . " ") | relURL }}"></script><!-- custom js added -->
{{ end }}{{ else }}<!-- no custom js detected -->{{ end }}
{{/* To comply with GDPR, cookie consent scripts places in head-end must execute before Google Analytics is enabled */ -}} {{/* make sure that head-end hook comes last */}}
{{ if hugo.IsProduction -}} {{ partial "hooks/head-end.html" . }}
{{ template "_internal/google_analytics.html" . }}
{{ end -}}

View File

@ -1,40 +1,3 @@
{{/* reference page-specific open graph image */}}
{{- if ( eq .Section "blog" ) -}}
{{ with findRE "<img.*?>" .Content 1 }}
<meta property="og:image" content="{{ index . 0 | replaceRE ".*src=\"(.+?)\".*" "$1" }}">
{{ end }}
{{- else -}}
{{- with resources.Get "images/kubernetes-horizontal-color.png" -}}
{{- with resources.Copy "images/kubernetes-open-graph.png" . -}}
<meta property="og:image" content="{{ .RelPermalink }}">
{{- else -}}
{{- warnf "No image. Boo." -}}
{{- end -}}
{{- end -}}
{{- end -}}
<link rel="manifest" href="/manifest.webmanifest">
{{ range .Translations -}}
<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}">
{{ end -}}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"url": "https://kubernetes.io",
"logo": "https://kubernetes.io/images/favicon.png",
{{- if not .Site.Params.deprecated }}
"potentialAction": {
"@type": "SearchAction",
"target": {{ printf "%s%s" ("search/" | absURL) "?q={search_term_string}" }},
"query-input": "required name=search_term_string"
}
{{ end }}
}
</script>
<meta name="theme-color" content="#326ce5">
<link rel="manifest" href="/manifest.webmanifest"> <link rel="manifest" href="/manifest.webmanifest">
{{- if or (.HasShortcode "table") (.HasShortcode "feature-gate-table") -}} {{- if or (.HasShortcode "table") (.HasShortcode "feature-gate-table") -}}
@ -92,9 +55,3 @@
{{- if or (.HasShortcode "code_sample") (.HasShortcode "code") (.HasShortcode "codenew") -}} {{- if or (.HasShortcode "code_sample") (.HasShortcode "code") (.HasShortcode "codenew") -}}
<link rel="stylesheet" href="/css/toastr-2.1.4.min.css"> <link rel="stylesheet" href="/css/toastr-2.1.4.min.css">
{{- end -}} {{- end -}}
{{- if eq (lower .Params.cid) "community" -}}
<script defer src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
{{- end -}}
{{ with .Params.js }}{{ range (split . ",") }}<script src="{{ (trim . " ") | relURL }}"></script><!-- custom js added -->
{{ end }}{{ else }}<!-- no custom js detected -->{{ end }}

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB