From: Danilo M. Date: Fri, 17 Apr 2026 10:24:04 +0000 (+0200) Subject: fix: use content-based 404 pages with proper language context X-Git-Tag: release_22042026-1342~125 X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=fe7c7a4841a58dec4b4957e9c9a32aec5adcade6;p=danix.xyz-2.git fix: use content-based 404 pages with proper language context Created language-specific 404 content pages (content/en/404.md and content/it/404.md) that Hugo renders with the correct language context. Updated redirect rules and created _default/404.html layout that uses i18n properly. Now .Lang is set correctly for translation strings. 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/hugo.toml b/hugo.toml index 364d0d3..efbf60b 100644 --- a/hugo.toml +++ b/hugo.toml @@ -127,10 +127,10 @@ enableRobotsTXT = true [[redirects]] from = '/it/**' - to = '/it/404.html' + to = '/it/' status = 404 [[redirects]] from = '/**' - to = '/404.html' + to = '/' status = 404 diff --git a/themes/danix-xyz-hacker/layouts/404.it.html b/themes/danix-xyz-hacker/layouts/404.it.html deleted file mode 100644 index 3b4ea2e..0000000 --- a/themes/danix-xyz-hacker/layouts/404.it.html +++ /dev/null @@ -1,151 +0,0 @@ -{{ define "main" }} - - - - -
-
-
- -

- 404 -

- - -

- Pagina Non Trovata -

- -

- Mi dispiace, la pagina che stai cercando non esiste. Prova a cercare o sfoglia gli articoli qui sotto. -

- - -
-
- - -
-
- -
-
- Nessun articolo trovato che corrisponda alla tua ricerca. -
-
- - -
-

Articoli Recenti

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

Scegli il Tuo Percorso

- -
- - - -
- - -
-
-
-
-
- -{{ end }} diff --git a/themes/danix-xyz-hacker/layouts/404.en.html b/themes/danix-xyz-hacker/layouts/_default/404.html similarity index 80% rename from themes/danix-xyz-hacker/layouts/404.en.html rename to themes/danix-xyz-hacker/layouts/_default/404.html index e1fd8c5..4b313cd 100644 --- a/themes/danix-xyz-hacker/layouts/404.en.html +++ b/themes/danix-xyz-hacker/layouts/_default/404.html @@ -24,21 +24,21 @@ window.articlesData = [

- Page Not Found + {{ i18n "notFound" }}

- Sorry, the page you're looking for doesn't exist. Try searching or browse the articles below. + {{ i18n "notFoundMessage" }}

- + @@ -54,13 +54,13 @@ window.articlesData = [
- No articles found matching your search. + {{ i18n "noSearchResults" }}
-

Recent Articles

+

{{ i18n "recentArticles" }}

{{ range first 5 (where .Site.RegularPages "Section" "articles") }}
@@ -77,14 +77,18 @@ window.articlesData = [ @@ -95,7 +99,7 @@ window.articlesData = [ @click="toggleEasterEgg()" class="text-sm text-text-dim hover:text-accent transition-colors underline" > - Follow the white rabbit... + {{ i18n "followWhiteRabbit" }}
@@ -114,15 +118,15 @@ window.articlesData = [
-

Choose Your Path

+

{{ i18n "easterEggTitle" }}