Merge pull request #1 from dogweather/dogweather-hreflang

Add hreflang links to HTML HEAD
This commit is contained in:
Robb Shecter 2024-01-29 13:51:37 -07:00 committed by GitHub
commit 49cd419e6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,19 @@
<title>{{ block "title" . }}{{ with .Params.Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title> <title>{{ block "title" . }}{{ with .Params.Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title>
<meta name="viewport" content="width=device-width,minimum-scale=1"> <meta name="viewport" content="width=device-width,minimum-scale=1">
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"> <meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
{{/*
Multilingual site support
See: https://developers.google.com/search/docs/specialty/international/localized-versions
*/}}
{{ with .AllTranslations }}
{{ range . }}
{{ if not (eq .Lang $.Page.Lang) }}
<link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}">
{{ end }}
{{ end }}
{{ end }}
{{ hugo.Generator }} {{ hugo.Generator }}
{{/* NOTE: For Production make sure you add `HUGO_ENV="production"` before your build command */}} {{/* NOTE: For Production make sure you add `HUGO_ENV="production"` before your build command */}}
{{ $production := eq (getenv "HUGO_ENV") "production" | or (eq site.Params.env "production") }} {{ $production := eq (getenv "HUGO_ENV") "production" | or (eq site.Params.env "production") }}