From e9f46b1e5a2c41bfe1da702b3823d64fb3d64017 Mon Sep 17 00:00:00 2001 From: Arne Rief Date: Thu, 9 Apr 2026 18:31:14 +0200 Subject: Replaced deprecated language methods & settings from hugo v0.156.0 & v0.158.0 --- layouts/_partials/select-language.html | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'layouts/_partials/select-language.html') diff --git a/layouts/_partials/select-language.html b/layouts/_partials/select-language.html index 6efcc61..5cb4a25 100644 --- a/layouts/_partials/select-language.html +++ b/layouts/_partials/select-language.html @@ -1,32 +1,30 @@ {{- /* Selection of available languages. -Dynamically links to corresponding page/post if a translated version exists, otherwise to homepage of that language as fallback. +Dynamically links to corresponding versions of a page/post in other languages if translations exists. -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. +Note: `.Site.Language.Name` and `.Site.Language.Locale` are interchangable with Argo's default hugo.toml configuration of `locale = "en"`. +Yet the differentiation is deliberately maintained here in case a user defines their locale to e.g. "en-US"; */ -}} -{{- if gt (len site.Languages) 1 }} -{{- $activeLang := .Lang }} -{{- $allTranslationsForPage := .Translations }} +{{- $pageVersionsList := .Rotate "language" }} +{{- if gt (len $pageVersionsList) 1 }}