diff options
author | Oscar Najera <hi@oscarnajera.com> | 2025-01-22 00:41:27 +0100 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2025-01-22 00:48:01 +0100 |
commit | 110ecfe2b5b9b513a2519a8682a5cf6f2bce78fa (patch) | |
tree | f56a91ef284c11f55b1959a121f03807f091d8c5 /layouts | |
parent | aefe0904492698d2996d59d3f86a0fe9af0f688b (diff) | |
download | hugo-minimalist-theme-110ecfe2b5b9b513a2519a8682a5cf6f2bce78fa.tar.gz hugo-minimalist-theme-110ecfe2b5b9b513a2519a8682a5cf6f2bce78fa.tar.bz2 hugo-minimalist-theme-110ecfe2b5b9b513a2519a8682a5cf6f2bce78fa.zip |
Translation meta hreflang
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/header.html | 1 | ||||
-rw-r--r-- | layouts/partials/structured-data.html | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index f3c929a..fce67da 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -39,6 +39,7 @@ name="lang" class="mr-2 p-1 text-center border border-black-20 rounded-md bg-white text-black" onchange="self.location=options[selectedIndex].value" + aria-label="Page language" > <option value="{{ .Permalink }}"> {{ .Language.Lang }} diff --git a/layouts/partials/structured-data.html b/layouts/partials/structured-data.html index eb42277..8b59734 100644 --- a/layouts/partials/structured-data.html +++ b/layouts/partials/structured-data.html @@ -78,6 +78,21 @@ {{ end }} {{ end }} +{{ if .IsTranslated }} + {{ range .Translations }} + <link + rel="alternate" + hreflang="{{ .Language.Lang }}" + href="{{ .Permalink }}" + /> + {{ end }} + <link + rel="alternate" + hreflang="{{ .Language.Lang }}" + href="{{ .Permalink }}" + /> +{{ end }} + {{- /* If it is part of a series, link to related articles */}} {{- $permalink := .Permalink }} {{- $siteSeries := .Site.Taxonomies.series }} |