From 2b8d928215509abcc63b802b3c0cd485cb9156c1 Mon Sep 17 00:00:00 2001 From: Mark Dumay <61946753+markdumay@users.noreply.github.com> Date: Thu, 19 Mar 2026 16:37:18 +0100 Subject: [PATCH] fix: resolve Hugo v0.158.0 build failures in multilingual sites Replace deprecated site.LanguageCode with site.Language.Lang in GetStaticURL. In Hugo v0.158.0, the language configuration refactor changed site.LanguageCode to return the global languageCode value (e.g. "en-us") instead of the language key (e.g. "en"), breaking the strings.TrimSuffix used to derive the base URL from site.Home.RelPermalink. site.Language.Lang always returns the language key matching the URL prefix, making this both a correct and backwards-compatible fix. Co-Authored-By: Claude Sonnet 4.6 --- layouts/_partials/utilities/GetStaticURL.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/_partials/utilities/GetStaticURL.html b/layouts/_partials/utilities/GetStaticURL.html index 4430b32..a4bc0a5 100644 --- a/layouts/_partials/utilities/GetStaticURL.html +++ b/layouts/_partials/utilities/GetStaticURL.html @@ -11,7 +11,7 @@ {{ $url = path.Clean $url }} {{ if not $url }}{{ $url = "/" }}{{ end }} - {{ $lang := site.LanguageCode | default site.Language.Lang }} + {{ $lang := site.Language.Lang }} {{ $base := strings.TrimSuffix (printf "%s/" $lang) site.Home.RelPermalink }} {{ $url = partial "utilities/URLJoin.html" (dict "base" $base "path" $url) }}