From: Danilo M. Date: Fri, 17 Apr 2026 09:44:47 +0000 (+0200) Subject: fix: detect language from permalink instead of .Lang in 404 template X-Git-Tag: release_22042026-1342~137 X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=4ea2790206ca925bcf810c3b10d8c18e44015c61;p=danix.xyz-2.git fix: detect language from permalink instead of .Lang in 404 template Hugo's .Lang is unreliable in 404 context. Changed to detect language from the request permalink (checking for /it/ prefix) to properly route Italian 404 pages to Italian content sections. Co-Authored-By: Claude Haiku 4.5 --- diff --git a/themes/danix-xyz-hacker/layouts/404.html b/themes/danix-xyz-hacker/layouts/404.html index a81f34d..efae232 100644 --- a/themes/danix-xyz-hacker/layouts/404.html +++ b/themes/danix-xyz-hacker/layouts/404.html @@ -77,17 +77,21 @@ window.articlesData = [
- {{ $homeLink := "/" }} - {{ if eq .Lang "it" }} - {{ $homeLink = "/it/" }} + {{ $lang := "en" }} + {{ if in .Permalink "/it/" }} + {{ $lang = "it" }} {{ end }} - + {{ $prefix := "" }} + {{ if eq $lang "it" }} + {{ $prefix = "/it" }} + {{ end }} + {{ i18n "goHome" }} - + {{ i18n "browseArticles" }} - + {{ i18n "contactSupport" }}