}
}));
+ Alpine.data('notFoundNav', () => ({
+ get homeLink() {
+ return window.currentLang === 'it' ? '/it/' : '/';
+ },
+ get articlesLink() {
+ return window.currentLang === 'it' ? '/it/articles/' : '/articles/';
+ },
+ get contactLink() {
+ return window.currentLang === 'it' ? '/it/is/here/' : '/is/here/';
+ }
+ }));
+
console.log('notFoundPage Alpine component registered');
});
{{ 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 = [
</div>
<!-- Navigation Links -->
- <div class="space-y-4 flex flex-col items-center mb-12">
- {{ $homeLink := "/" }}
- {{ if eq .Lang "it" }}
- {{ $homeLink = "/it/" }}
- {{ end }}
- <a href="{{ $homeLink }}" class="btn btn-primary">
+ <div class="space-y-4 flex flex-col items-center mb-12" x-data="notFoundNav()">
+ <a :href="homeLink" class="btn btn-primary">
{{ i18n "goHome" }}
</a>
- <a href="{{ if eq .Lang "it" }}/it{{ end }}/articles/" class="btn btn-secondary">
+ <a :href="articlesLink" class="btn btn-secondary">
{{ i18n "browseArticles" }}
</a>
- <a href="{{ if eq .Lang "it" }}/it{{ end }}/is/here/" class="btn btn-outline">
+ <a :href="contactLink" class="btn btn-outline">
{{ i18n "contactSupport" }}
</a>
</div>