diff options
| author | Arne Rief <riearn@proton.me> | 2026-01-09 12:24:05 +0100 |
|---|---|---|
| committer | Arne Rief <riearn@proton.me> | 2026-01-09 12:24:05 +0100 |
| commit | f8541ef965ca22e746b523eb418e47cb4f78f2d8 (patch) | |
| tree | 49e1540ed42595a44196817eadf97337587a2aea /layouts/partials/select-language.html | |
| parent | 038054b8206a9c25e84adeb0f0f355abd22d6143 (diff) | |
Upgrade to new template system from Hugo v0.146.0
Diffstat (limited to 'layouts/partials/select-language.html')
| -rw-r--r-- | layouts/partials/select-language.html | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/layouts/partials/select-language.html b/layouts/partials/select-language.html deleted file mode 100644 index 6efcc61..0000000 --- a/layouts/partials/select-language.html +++ /dev/null @@ -1,38 +0,0 @@ -{{- /* -Selection of available languages. -Dynamically links to corresponding page/post if a translated version exists, otherwise to homepage of that language as fallback. - -Note: `$activeLang` and `$allTranslationsForPage` are technically unnecessary variables, their values could be called with `$.Lang` and `$.Translations` respectively. -These variables - together with the explicit naming of `.` context variables in other cases - were chosen for better readability and understandability of the code. -*/ -}} - -{{- if gt (len site.Languages) 1 }} -{{- $activeLang := .Lang }} -{{- $allTranslationsForPage := .Translations }} - <div class="language-select"> - <ul class="language-select__language-list"> - {{- range site.Languages }} - {{- $currLangSlice := . }} - {{- if ne $currLangSlice.Lang $activeLang }} - {{- $targetPage := index (where site.Home.Translations "Lang" $currLangSlice.Lang) 0 }} - {{- $translatedPage := index (where $allTranslationsForPage "Lang" $currLangSlice.Lang) 0 }} - {{- if $translatedPage }}{{- $targetPage = $translatedPage }}{{- end }} - <li class="language-select__language-item"> - <a - href="{{ $targetPage.RelPermalink }}" - hreflang="{{ $targetPage.Lang }}" - aria-label="{{ $targetPage.LinkTitle }} ({{ or $targetPage.Language.LanguageName $targetPage.Lang }})" - > - <img - src="/flags/{{ $targetPage.Lang }}.svg" - class="icon icon-flag" - alt="{{ $targetPage.LinkTitle }} ({{ or $targetPage.Language.LanguageName $targetPage.Lang }})" - aria-hidden="true" - /> - </a> - </li> - {{- end }} - {{- end }} - </ul> - </div> -{{- end }} |
