From fe7c7a4841a58dec4b4957e9c9a32aec5adcade6 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 17 Apr 2026 12:24:04 +0200 Subject: 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 --- content/en/404.md | 5 + content/it/404.md | 5 + hugo.toml | 4 +- themes/danix-xyz-hacker/layouts/404.en.html | 151 --------------------- themes/danix-xyz-hacker/layouts/404.it.html | 151 --------------------- themes/danix-xyz-hacker/layouts/_default/404.html | 155 ++++++++++++++++++++++ 6 files changed, 167 insertions(+), 304 deletions(-) create mode 100644 content/en/404.md create mode 100644 content/it/404.md delete mode 100644 themes/danix-xyz-hacker/layouts/404.en.html delete mode 100644 themes/danix-xyz-hacker/layouts/404.it.html create mode 100644 themes/danix-xyz-hacker/layouts/_default/404.html 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.en.html b/themes/danix-xyz-hacker/layouts/404.en.html deleted file mode 100644 index e1fd8c5..0000000 --- a/themes/danix-xyz-hacker/layouts/404.en.html +++ /dev/null @@ -1,151 +0,0 @@ -{{ define "main" }} - - - - -
-
-
- -

- 404 -

- - -

- Page Not Found -

- -

- Sorry, the page you're looking for doesn't exist. Try searching or browse the articles below. -

- - -
-
- - -
-
- -
-
- No articles found matching your search. -
-
- - -
-

Recent Articles

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

Choose Your Path

- -
- - - -
- - -
-
-
-
-
- -{{ end }} 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/_default/404.html b/themes/danix-xyz-hacker/layouts/_default/404.html new file mode 100644 index 0000000..4b313cd --- /dev/null +++ b/themes/danix-xyz-hacker/layouts/_default/404.html @@ -0,0 +1,155 @@ +{{ define "main" }} + + + + +
+
+
+ +

+ 404 +

+ + +

+ {{ i18n "notFound" }} +

+ +

+ {{ i18n "notFoundMessage" }} +

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

{{ i18n "recentArticles" }}

+
+ {{ range first 5 (where .Site.RegularPages "Section" "articles") }} + + {{ end }} +
+
+ + +
+ {{ $homeLink := "/" }} + {{ if eq .Lang "it" }} + {{ $homeLink = "/it/" }} + {{ end }} + + {{ i18n "goHome" }} + + + {{ i18n "browseArticles" }} + + + {{ i18n "contactSupport" }} + +
+ + +
+ +
+ + +
+ +
+ + +
+

{{ i18n "easterEggTitle" }}

+ +
+ + + +
+ + +
+
+
+
+
+ +{{ end }} -- cgit v1.2.3