From 4ea2790206ca925bcf810c3b10d8c18e44015c61 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 17 Apr 2026 11:44:47 +0200 Subject: 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 --- themes/danix-xyz-hacker/layouts/404.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'themes') 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" }}
-- cgit v1.2.3