]> danix's work - danix.xyz-2.git/commitdiff
fix: simplify 404 page to use Hugo's standard i18n without hacks
authorDanilo M. <redacted>
Fri, 17 Apr 2026 10:03:46 +0000 (12:03 +0200)
committerDanilo M. <redacted>
Fri, 17 Apr 2026 10:03:46 +0000 (12:03 +0200)
Removed JavaScript language detection and Alpine component. Use simple
static links that work with both languages. Hugo's redirect rules and
i18n system handle language context automatically. No JavaScript hacks.

Co-Authored-By: Claude Haiku 4.5 <redacted>
themes/danix-xyz-hacker/assets/js/not-found-page.js
themes/danix-xyz-hacker/layouts/404.html

index cec60bd469b1f851276fe9536995c58dfdbfbbef..6ec8895ed0ea3f023e9fb48814d578bb23d2185a 100644 (file)
@@ -31,29 +31,5 @@ document.addEventListener('alpine:init', () => {
     }
   }));
 
-  Alpine.data('notFoundNav', () => {
-    const isItalian = window.location.pathname.startsWith('/it/');
-    return {
-      get homeLink() {
-        return isItalian ? '/it/' : '/';
-      },
-      get articlesLink() {
-        return isItalian ? '/it/articles/' : '/articles/';
-      },
-      get contactLink() {
-        return isItalian ? '/it/is/here/' : '/is/here/';
-      },
-      goHome() {
-        window.location.href = this.homeLink;
-      },
-      goArticles() {
-        window.location.href = this.articlesLink;
-      },
-      goContact() {
-        window.location.href = this.contactLink;
-      }
-    };
-  });
-
   console.log('notFoundPage Alpine component registered');
 });
index 341f90b16e75e550b2e32d36d79b6ad961f6955c..6ed4892387f9ccf9716be409beb81f20ef12685e 100644 (file)
@@ -1,10 +1,5 @@
 {{ define "main" }}
 
-<!-- Detect language from current URL -->
-<script>
-window.currentLang = window.location.pathname.startsWith('/it/') ? 'it' : 'en';
-</script>
-
 <!-- Pass articles data to JavaScript for Alpine.js -->
 <script>
 window.articlesData = [
@@ -81,14 +76,14 @@ window.articlesData = [
     </div>
 
     <!-- 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">
+    <div class="space-y-4 flex flex-col items-center mb-12">
+      <a href="/" class="btn btn-primary">
         {{ i18n "goHome" }}
       </a>
-      <a :href="articlesLink" @click.prevent="goArticles()" class="btn btn-secondary">
+      <a href="/articles/" class="btn btn-secondary">
         {{ i18n "browseArticles" }}
       </a>
-      <a :href="contactLink" @click.prevent="goContact()" class="btn btn-outline">
+      <a href="/is/here/" class="btn btn-outline">
         {{ i18n "contactSupport" }}
       </a>
     </div>