From: Danilo M. Date: Fri, 17 Apr 2026 09:49:24 +0000 (+0200) Subject: fix: use Hugo content-based 404 pages for proper multilingual support X-Git-Tag: release_22042026-1342~135 X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=1cab4424a5c6dd2aeb453d299b6a2f12a840599d;p=danix.xyz-2.git fix: use Hugo content-based 404 pages for proper multilingual support Created language-specific 404 pages (content/en/404.md and content/it/404.md) instead of using JavaScript detection. Hugo now properly routes 404 errors to the correct language context, allowing .Lang and i18n to work correctly. Removed JS language detection hack. 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..6e619f2 --- /dev/null +++ b/content/en/404.md @@ -0,0 +1,5 @@ +--- +title: "404 Not Found" +outputs: + - html +--- diff --git a/content/it/404.md b/content/it/404.md new file mode 100644 index 0000000..6e619f2 --- /dev/null +++ b/content/it/404.md @@ -0,0 +1,5 @@ +--- +title: "404 Not Found" +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 78e3591..6ec8895 100644 --- a/themes/danix-xyz-hacker/assets/js/not-found-page.js +++ b/themes/danix-xyz-hacker/assets/js/not-found-page.js @@ -31,17 +31,5 @@ document.addEventListener('alpine:init', () => { } })); - Alpine.data('notFoundNav', () => ({ - get homeLink() { - return window.currentLang === 'it' ? '/it/' : '/'; - }, - get articlesLink() { - return window.currentLang === 'it' ? '/it/articles/' : '/articles/'; - }, - get contactLink() { - return window.currentLang === 'it' ? '/it/is/here/' : '/is/here/'; - } - })); - console.log('notFoundPage Alpine component registered'); }); diff --git a/themes/danix-xyz-hacker/layouts/404.html b/themes/danix-xyz-hacker/layouts/404.html index 0fb6c9a..a81f34d 100644 --- a/themes/danix-xyz-hacker/layouts/404.html +++ b/themes/danix-xyz-hacker/layouts/404.html @@ -1,10 +1,5 @@ {{ define "main" }} - - -