Sprachenswitcher des Themes korrigiert um auf LanguageKeys zu korrigieren

This commit is contained in:
Andreas Hnida 2024-03-21 11:59:49 +01:00
commit 03141192e5

View file

@ -10,102 +10,46 @@
</div> </div>
<!-- navbar toggler --> <!-- navbar toggler -->
<input id="nav-toggle" type="checkbox" class="hidden" /> <input id="nav-toggle" type="checkbox" class="hidden" />
<label <label for="nav-toggle" class="order-3 cursor-pointer flex items-center lg:hidden text-dark lg:order-1">
for="nav-toggle"
class="order-3 cursor-pointer flex items-center lg:hidden text-dark lg:order-1">
<svg id="show-button" class="h-6 fill-current block" viewBox="0 0 20 20"> <svg id="show-button" class="h-6 fill-current block" viewBox="0 0 20 20">
<title>Menu Open</title> <title>Menu Open</title>
<path d="M0 3h20v2H0V3z m0 6h20v2H0V9z m0 6h20v2H0V0z"></path> <path d="M0 3h20v2H0V3z m0 6h20v2H0V9z m0 6h20v2H0V0z"></path>
</svg> </svg>
<svg id="hide-button" class="h-6 fill-current hidden" viewBox="0 0 20 20"> <svg id="hide-button" class="h-6 fill-current hidden" viewBox="0 0 20 20">
<title>Menu Close</title> <title>Menu Close</title>
<polygon <polygon points="11 9 22 9 22 11 11 11 11 22 9 22 9 11 -2 11 -2 9 9 9 9 -2 11 -2" transform="rotate(45 10 10)"></polygon>
points="11 9 22 9 22 11 11 11 11 22 9 22 9 11 -2 11 -2 9 9 9 9 -2 11 -2"
transform="rotate(45 10 10)"></polygon>
</svg> </svg>
</label> </label>
<!-- /navbar toggler -->
<!-- main navbar --> <!-- main navbar -->
<ul <ul id="nav-menu" class="navbar-nav order-3 hidden lg:flex w-full pb-6 lg:order-1 lg:w-auto lg:space-x-2 lg:pb-0 xl:space-x-8">
id="nav-menu"
class="navbar-nav order-3 hidden lg:flex w-full pb-6 lg:order-1 lg:w-auto lg:space-x-2 lg:pb-0 xl:space-x-8">
{{ $currentPage := . }} {{ $currentPage := . }}
{{ range site.Menus.main }} {{ range site.Menus.main }}
{{ $menuURL := .URL | absLangURL }} {{ $menuURL := .URL | absLangURL }}
{{ $pageURL:= $currentPage.Permalink | absLangURL }} {{ $pageURL:= $currentPage.Permalink | absLangURL }}
{{ $active := eq $menuURL $pageURL }} {{ $active := eq $menuURL $pageURL }}
{{ if .HasChildren }} <li class="nav-item {{ if .HasChildren }}nav-dropdown group relative{{ end }}">
<li class="nav-item nav-dropdown group relative"> <a href="{{ .URL | relLangURL }}" class="nav-link {{ if $active }}active{{ end }} inline-flex items-center">
<span {{ .Name }}
class="nav-link {{ range .Children }} {{ if .HasChildren }}
{{ $childURL := .URL | absLangURL }} <svg class="ml-2 h-4 w-4 fill-current" viewBox="0 0 20 20">
{{ $active := eq $childURL $pageURL }} <path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" />
{{ if $active }}active{{ end }}
{{ end }} inline-flex items-center">
{{ .Name }}
<svg class="h-4 w-4 fill-current" viewBox="0 0 20 20">
<path
d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" />
</svg> </svg>
</span> {{ end }}
<ul </a>
class="nav-dropdown-list lg:group-hover:visible lg:group-hover:opacity-100"> {{ if .HasChildren }}
<ul class="nav-dropdown-list lg:group-hover:visible lg:group-hover:opacity-100">
{{ range .Children }} {{ range .Children }}
{{ $childURL := .URL | absLangURL }}
{{ $active := eq $childURL $pageURL }}
<li class="nav-dropdown-item"> <li class="nav-dropdown-item">
<a <a class="nav-dropdown-link {{ if eq (.URL | absLangURL) $pageURL }}active{{ end }}" href="{{ .URL | relLangURL }}">
class="nav-dropdown-link {{ if $active }}
active
{{- end -}}"
{{ if findRE `^http` .URL }}
target="_blank" rel="noopener"
{{ end }}
href="{{- if findRE `^#` .URL -}}
{{- if not $.IsHome -}}
{{- site.Home.RelPermalink -}}
{{- end }}
{{- .URL -}}
{{- else -}}
{{- .URL | relLangURL -}}
{{- end -}}">
{{ .Name }} {{ .Name }}
</a> </a>
</li> </li>
{{ end }} {{ end }}
</ul> </ul>
</li> {{ end }}
{{ else }}
<li class="nav-item">
<a
class="nav-link {{ if $active }}active{{- end -}}"
{{ if findRE `^http` .URL }}
target="_blank" rel="noopener"
{{ end }}
href="{{- if findRE `^#` .URL -}}
{{- if not $.IsHome -}}
{{- site.Home.RelPermalink -}}
{{- end }}{{- .URL -}}
{{- else -}}
{{- .URL | relLangURL -}}
{{- end -}}"
>{{ .Name }}</a
>
</li>
{{ end }}
{{ end }}
{{ if site.Params.navigation_button.enable }}
<li class="mt-4 inline-block lg:hidden">
<a
class="btn btn-outline-primary btn-sm"
href="{{ site.Params.navigation_button.link | relLangURL }}">
{{ site.Params.navigation_button.label }}
</a>
</li> </li>
{{ end }} {{ end }}
</ul> </ul>
<div class="order-1 ml-auto flex items-center md:order-2 lg:ml-0"> <div class="order-1 ml-auto flex items-center md:order-2 lg:ml-0">
{{ with site.Params.search }} {{ with site.Params.search }}
{{ if .enable }} {{ if .enable }}