diff options
| -rw-r--r-- | themes/danix-xyz-hacker/layouts/404.html | 61 |
1 files changed, 48 insertions, 13 deletions
diff --git a/themes/danix-xyz-hacker/layouts/404.html b/themes/danix-xyz-hacker/layouts/404.html index 341f90b..9b50b44 100644 --- a/themes/danix-xyz-hacker/layouts/404.html +++ b/themes/danix-xyz-hacker/layouts/404.html @@ -1,5 +1,40 @@ {{ define "main" }} +{{ $lang := "en" }} +{{ if in .Permalink "/it/" }} + {{ $lang = "it" }} +{{ end }} + +{{ $translations := dict "en" (dict + "notFound" "Page Not Found" + "notFoundMessage" "Sorry, the page you're looking for doesn't exist. Try searching or browse the articles below." + "searchPlaceholder" "Search articles..." + "noSearchResults" "No articles found matching your search." + "recentArticles" "Recent Articles" + "goHome" "Go Home" + "browseArticles" "Browse Articles" + "contactSupport" "Get in Touch" + "followWhiteRabbit" "Follow the white rabbit..." + "easterEggTitle" "Choose Your Path" + "bluePill" "Stay Here" + "redPill" "Show Me More" +) "it" (dict + "notFound" "Pagina Non Trovata" + "notFoundMessage" "Mi dispiace, la pagina che stai cercando non esiste. Prova a cercare o sfoglia gli articoli qui sotto." + "searchPlaceholder" "Cerca articoli..." + "noSearchResults" "Nessun articolo trovato che corrisponda alla tua ricerca." + "recentArticles" "Articoli Recenti" + "goHome" "Torna a Casa" + "browseArticles" "Sfoglia Articoli" + "contactSupport" "Contattami" + "followWhiteRabbit" "Segui il coniglio bianco..." + "easterEggTitle" "Scegli il Tuo Percorso" + "bluePill" "Rimani Qui" + "redPill" "Mostrami di Più" +) }} + +{{ $t := index $translations $lang }} + <!-- Detect language from current URL --> <script> window.currentLang = window.location.pathname.startsWith('/it/') ? 'it' : 'en'; @@ -29,21 +64,21 @@ window.articlesData = [ <!-- Error Message --> <h2 class="text-3xl md:text-4xl font-bold mb-6"> - {{ i18n "notFound" }} + {{ index $t "notFound" }} </h2> <p class="text-lg text-text-dim mb-8"> - {{ i18n "notFoundMessage" }} + {{ index $t "notFoundMessage" }} </p> <!-- Search Box --> <div class="mb-12"> <form id="search-form" class="flex flex-col gap-4"> - <label for="search-input" class="sr-only">{{ i18n "searchPlaceholder" }}</label> + <label for="search-input" class="sr-only">{{ index $t "searchPlaceholder" }}</label> <input id="search-input" type="text" - placeholder="{{ (i18n "searchPlaceholder") }}" + placeholder="{{ index $t "searchPlaceholder" }}" class="px-4 py-3 border-2 border-border rounded focus:outline-none focus:ring-2 focus:ring-accent focus:border-transparent bg-bg text-text" @input="filterArticles($el.value)" /> @@ -59,13 +94,13 @@ window.articlesData = [ </template> </div> <div x-show="searchQuery && filteredArticles.length === 0" class="mt-4 text-text-dim"> - {{ i18n "noSearchResults" }} + {{ index $t "noSearchResults" }} </div> </div> <!-- Recent Articles Section --> <div class="mb-12"> - <h3 class="text-2xl font-bold mb-6">{{ i18n "recentArticles" }}</h3> + <h3 class="text-2xl font-bold mb-6">{{ index $t "recentArticles" }}</h3> <div class="space-y-4"> {{ range first 5 (where .Site.RegularPages "Section" "articles") }} <div class="p-4 border-l-4 border-accent bg-bg/50 hover:bg-bg/70 transition-colors"> @@ -83,13 +118,13 @@ window.articlesData = [ <!-- Navigation Links --> <div class="space-y-4 flex flex-col items-center mb-12" x-data="notFoundNav()"> <a :href="homeLink" @click.prevent="goHome()" class="btn btn-primary"> - {{ i18n "goHome" }} + {{ index $t "goHome" }} </a> <a :href="articlesLink" @click.prevent="goArticles()" class="btn btn-secondary"> - {{ i18n "browseArticles" }} + {{ index $t "browseArticles" }} </a> <a :href="contactLink" @click.prevent="goContact()" class="btn btn-outline"> - {{ i18n "contactSupport" }} + {{ index $t "contactSupport" }} </a> </div> @@ -100,7 +135,7 @@ window.articlesData = [ @click="toggleEasterEgg()" class="text-sm text-text-dim hover:text-accent transition-colors underline" > - {{ i18n "followWhiteRabbit" }} + {{ index $t "followWhiteRabbit" }} </button> </div> @@ -119,7 +154,7 @@ window.articlesData = [ <!-- Modal Content --> <div class="relative bg-bg border-2 border-accent p-8 rounded-lg shadow-xl max-w-md mx-4"> - <h2 class="text-2xl font-bold mb-6 text-accent">{{ i18n "easterEggTitle" }}</h2> + <h2 class="text-2xl font-bold mb-6 text-accent">{{ index $t "easterEggTitle" }}</h2> <div class="space-y-4"> <button @@ -127,7 +162,7 @@ window.articlesData = [ @click="showEasterEgg = false; window.location.href = '{{ .Site.BaseURL }}'" class="w-full btn btn-primary" > - 💊 {{ i18n "bluePill" }} + 💊 {{ index $t "bluePill" }} </button> <button @@ -135,7 +170,7 @@ window.articlesData = [ @click="goToRandomArticle()" class="w-full btn btn-secondary" > - 🐰 {{ i18n "redPill" }} + 🐰 {{ index $t "redPill" }} </button> </div> |
