localizing Home, Events and News
All checks were successful
publish / publish (push) Successful in 24s
All checks were successful
publish / publish (push) Successful in 24s
This commit is contained in:
parent
18f5c29b22
commit
554fd85510
5 changed files with 102 additions and 48 deletions
|
@ -38,13 +38,23 @@
|
|||
<!-- Localization Auto Redirect -->
|
||||
{{ if .IsHome }}
|
||||
<script>
|
||||
const lang = navigator.language;
|
||||
const cachedLang = localStorage.getItem("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/";
|
||||
if (cachedLang) {
|
||||
if (cachedLang === "de" && path !== "/") {
|
||||
window.location.href = "/";
|
||||
} else if (cachedLang === "en" && path !== "/en/") {
|
||||
window.location.href = "/en/";
|
||||
}
|
||||
} else {
|
||||
const lang = navigator.language;
|
||||
|
||||
if (lang.startsWith("de")) {
|
||||
localStorage.setItem("language", "de");
|
||||
} else {
|
||||
localStorage.setItem("language", "en");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
||||
|
@ -53,7 +63,7 @@
|
|||
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
|
||||
|
||||
<!-- Event Calendar -->
|
||||
{{ if eq .RelPermalink "/events/" }}
|
||||
{{ if or (eq .RelPermalink "/events/") (eq .RelPermalink "/en/events/") }}
|
||||
<link href='https://cdn.jsdelivr.net/npm/fullcalendar@5/main.min.css' rel='stylesheet'/>
|
||||
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@5/main.min.js'></script>
|
||||
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@5/locales/de.js'></script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue