summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker/layouts/404.html
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-04-17 11:44:47 +0200
committerDanilo M. <danix@danix.xyz>2026-04-17 11:44:47 +0200
commit4ea2790206ca925bcf810c3b10d8c18e44015c61 (patch)
tree5fad62a4097f487c60adf71088a3980cbbb912d9 /themes/danix-xyz-hacker/layouts/404.html
parentdb63ac7d287909b5f4bde23d460d8c4f3731b63e (diff)
downloaddanixxyz-4ea2790206ca925bcf810c3b10d8c18e44015c61.tar.gz
danixxyz-4ea2790206ca925bcf810c3b10d8c18e44015c61.zip
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 <noreply@anthropic.com>
Diffstat (limited to 'themes/danix-xyz-hacker/layouts/404.html')
-rw-r--r--themes/danix-xyz-hacker/layouts/404.html16
1 files changed, 10 insertions, 6 deletions
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 = [
<!-- Navigation Links -->
<div class="space-y-4 flex flex-col items-center mb-12">
- {{ $homeLink := "/" }}
- {{ if eq .Lang "it" }}
- {{ $homeLink = "/it/" }}
+ {{ $lang := "en" }}
+ {{ if in .Permalink "/it/" }}
+ {{ $lang = "it" }}
{{ end }}
- <a href="{{ $homeLink }}" class="btn btn-primary">
+ {{ $prefix := "" }}
+ {{ if eq $lang "it" }}
+ {{ $prefix = "/it" }}
+ {{ end }}
+ <a href="{{ $prefix }}/" class="btn btn-primary">
{{ i18n "goHome" }}
</a>
- <a href="{{ if eq .Lang "it" }}/it{{ end }}/articles/" class="btn btn-secondary">
+ <a href="{{ $prefix }}/articles/" class="btn btn-secondary">
{{ i18n "browseArticles" }}
</a>
- <a href="{{ if eq .Lang "it" }}/it{{ end }}/is/here/" class="btn btn-outline">
+ <a href="{{ $prefix }}/is/here/" class="btn btn-outline">
{{ i18n "contactSupport" }}
</a>
</div>