localizing auto redirect
All checks were successful
publish / publish (push) Successful in 24s

This commit is contained in:
Jannik Menzel 2025-06-16 16:41:59 +02:00
parent c33d245221
commit 18f5c29b22

View file

@ -35,6 +35,19 @@
} }
})(); })();
</script> </script>
<!-- Localization Auto Redirect -->
{{ if .IsHome }}
<script>
const lang = navigator.language;
const path = window.location.pathname;
if (lang.startsWith('de') && path !== "/") {
window.location.href = "/";
} else if (!lang.startsWith('de') && path !== "/en/") {
window.location.href = "/en/";
}
</script>
{{ end }}
<!-- Exo 2 Font --> <!-- Exo 2 Font -->
<link href="https://fonts.googleapis.com/css2?family=Exo+2:wght@400;500;600&display=swap" rel="stylesheet"/> <link href="https://fonts.googleapis.com/css2?family=Exo+2:wght@400;500;600&display=swap" rel="stylesheet"/>
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title> <title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>