From: Danilo M. Date: Fri, 17 Apr 2026 09:58:02 +0000 (+0200) Subject: fix: use language-specific 404 layouts for proper i18n support X-Git-Tag: release_22042026-1342~130 X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=94a11324999f07feff138364633e8442947b628a;p=danix.xyz-2.git fix: use language-specific 404 layouts for proper i18n support Created separate 404.html layouts in themes/danix-xyz-hacker/layouts/it/ and themes/danix-xyz-hacker/layouts/en/ with hardcoded language-specific links. Hugo automatically routes language requests to the correct layout, enabling proper i18n context and translations. Removed generic 404.html and all JavaScript detection hacks. Co-Authored-By: Claude Haiku 4.5 --- diff --git a/content/en/404.md b/content/en/404.md new file mode 100644 index 0000000..ce95b59 --- /dev/null +++ b/content/en/404.md @@ -0,0 +1,5 @@ +--- +title: "404" +outputs: + - html +--- diff --git a/content/it/404.md b/content/it/404.md new file mode 100644 index 0000000..ce95b59 --- /dev/null +++ b/content/it/404.md @@ -0,0 +1,5 @@ +--- +title: "404" +outputs: + - html +--- diff --git a/themes/danix-xyz-hacker/assets/js/not-found-page.js b/themes/danix-xyz-hacker/assets/js/not-found-page.js index cec60bd..e86af02 100644 --- a/themes/danix-xyz-hacker/assets/js/not-found-page.js +++ b/themes/danix-xyz-hacker/assets/js/not-found-page.js @@ -31,29 +31,6 @@ document.addEventListener('alpine:init', () => { } })); - Alpine.data('notFoundNav', () => { - const isItalian = window.location.pathname.startsWith('/it/'); - return { - get homeLink() { - return isItalian ? '/it/' : '/'; - }, - get articlesLink() { - return isItalian ? '/it/articles/' : '/articles/'; - }, - get contactLink() { - return isItalian ? '/it/is/here/' : '/is/here/'; - }, - goHome() { - window.location.href = this.homeLink; - }, - goArticles() { - window.location.href = this.articlesLink; - }, - goContact() { - window.location.href = this.contactLink; - } - }; - }); console.log('notFoundPage Alpine component registered'); }); diff --git a/themes/danix-xyz-hacker/layouts/404.html b/themes/danix-xyz-hacker/layouts/en/404.html similarity index 91% rename from themes/danix-xyz-hacker/layouts/404.html rename to themes/danix-xyz-hacker/layouts/en/404.html index 341f90b..6ed4892 100644 --- a/themes/danix-xyz-hacker/layouts/404.html +++ b/themes/danix-xyz-hacker/layouts/en/404.html @@ -1,10 +1,5 @@ {{ define "main" }} - - - + +
+
+
+ +

+ 404 +

+ + +

+ {{ i18n "notFound" }} +

+ +

+ {{ i18n "notFoundMessage" }} +

+ + +
+
+ + +
+
+ +
+
+ {{ i18n "noSearchResults" }} +
+
+ + +
+

{{ i18n "recentArticles" }}

+
+ {{ range first 5 (where .Site.RegularPages "Section" "articles") }} + + {{ end }} +
+
+ + + + + +
+ +
+ + +
+ +
+ + +
+

{{ i18n "easterEggTitle" }}

+ +
+ + + +
+ + +
+
+
+
+
+ +{{ end }}