{{ 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';
<!-- 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)"
/>
</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">
<!-- 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>
@click="toggleEasterEgg()"
class="text-sm text-text-dim hover:text-accent transition-colors underline"
>
- {{ i18n "followWhiteRabbit" }}
+ {{ index $t "followWhiteRabbit" }}
</button>
</div>
<!-- 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
@click="showEasterEgg = false; window.location.href = '{{ .Site.BaseURL }}'"
class="w-full btn btn-primary"
>
- π {{ i18n "bluePill" }}
+ π {{ index $t "bluePill" }}
</button>
<button
@click="goToRandomArticle()"
class="w-full btn btn-secondary"
>
- π° {{ i18n "redPill" }}
+ π° {{ index $t "redPill" }}
</button>
</div>