From b46ab43626cf826aa1051b9a745925fe6b701260 Mon Sep 17 00:00:00 2001 From: Robb Shecter Date: Mon, 29 Jan 2024 13:50:54 -0700 Subject: [PATCH 1/3] Add hreflang links to HTML HEAD --- layouts/_default/baseof.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 52e7e67a3..d63e0a871 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -7,6 +7,19 @@ {{ block "title" . }}{{ with .Params.Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }} + + {{/* + Multilingual site support + See: https://developers.google.com/search/docs/specialty/international/localized-versions + */}} + {{ with .AllTranslations }} + {{ range . }} + {{ if not (eq .Lang $.Page.Lang) }} + + {{ end }} + {{ end }} + {{ end }} + {{ hugo.Generator }} {{/* 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") }} From 3b155a3b57bc60c550f7b085efb82479fc7757eb Mon Sep 17 00:00:00 2001 From: Robb Shecter Date: Mon, 29 Jan 2024 13:56:50 -0700 Subject: [PATCH 2/3] fix: a page should list itself --- layouts/_default/baseof.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index d63e0a871..594990c9a 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -14,9 +14,7 @@ */}} {{ with .AllTranslations }} {{ range . }} - {{ if not (eq .Lang $.Page.Lang) }} - - {{ end }} + {{ end }} {{ end }} From b4878839092fceddb850962e96cffa0deb36f87b Mon Sep 17 00:00:00 2001 From: Robb Shecter Date: Mon, 29 Jan 2024 16:13:01 -0700 Subject: [PATCH 3/3] Documentation --- layouts/_default/baseof.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 594990c9a..23cb616fd 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -10,7 +10,8 @@ {{/* Multilingual site support - See: https://developers.google.com/search/docs/specialty/international/localized-versions + * https://gohugo.io/methods/page/alltranslations/ + * https://developers.google.com/search/docs/specialty/international/localized-versions */}} {{ with .AllTranslations }} {{ range . }}