diff options
| author | Arne Rief <riearn@proton.me> | 2025-09-01 21:57:30 +0200 |
|---|---|---|
| committer | Arne Rief <riearn@proton.me> | 2025-09-01 21:57:30 +0200 |
| commit | ade244c72af62827c4c30151404abf755597f243 (patch) | |
| tree | 1d6c5c3b24912ab5e5665bad06bb07b1f43c77ac /layouts/partials/selectLanguage.html | |
| parent | dac4024abcfea76f14522a84bee4b7258c37b72d (diff) | |
Search & socials
Diffstat (limited to 'layouts/partials/selectLanguage.html')
| -rw-r--r-- | layouts/partials/selectLanguage.html | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/layouts/partials/selectLanguage.html b/layouts/partials/selectLanguage.html deleted file mode 100644 index 752b605..0000000 --- a/layouts/partials/selectLanguage.html +++ /dev/null @@ -1,39 +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" style="background-color: yellow;"> - <ul> - {{- 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> - <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" - style="max-height: 32px" - alt="{{ $targetPage.LinkTitle }} ({{ or $targetPage.Language.LanguageName $targetPage.Lang }})" - aria-hidden="true" - /> - </a> - </li> - {{- end }} - {{- end }} - </ul> - </div> -{{- end }} |
