From dac4024abcfea76f14522a84bee4b7258c37b72d Mon Sep 17 00:00:00 2001 From: Arne Rief Date: Wed, 20 Aug 2025 21:36:19 +0200 Subject: Language selection & theme toggle --- layouts/partials/selectLanguage.html | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 layouts/partials/selectLanguage.html (limited to 'layouts/partials/selectLanguage.html') diff --git a/layouts/partials/selectLanguage.html b/layouts/partials/selectLanguage.html new file mode 100644 index 0000000..752b605 --- /dev/null +++ b/layouts/partials/selectLanguage.html @@ -0,0 +1,39 @@ +{{- /* +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 }} +
+ +
+{{- end }} -- cgit v1.2.3