This commit is contained in:
GZod01 2024-08-18 15:56:47 +02:00
parent 70e20d65cf
commit 256abc59b3

View file

@ -31,18 +31,18 @@
{{ $current := . }} {{ $current := . }}
{{ range .Site.Menus.main.ByWeight }} {{ range .Site.Menus.main.ByWeight }}
{{ $active := "" }} {{ $active := "" }}
{{ $menu_item_url := .URL | relLangURL }} {{ $menu_item_url := (.URL | relLangURL) }}
{{ $page_url:= $current.RelPermalink | relLangURL }} {{ $page_url:= $current.RelPermalink | relLangURL }}
{{ if eq $menu_item_url $page_url }} {{ if eq $menu_item_url $page_url }}
{{ $active = "active" }} {{ $active = "active" }}
{{ end }} {{ end }}
{{ if (and (hasPrefix $page_url $menu_item_url) (not (eq $menu_item_url "/"))) }} {{ if (and (hasPrefix $page_url $menu_item_url) (not (eq $menu_item_url ("/" | relLangURL)))) }}
{{ $active = "active" }} {{ $active = "active" }}
{{ end }} {{ end }}
<div class="header-nav-item"> <div class="header-nav-item">
<a <a
href="{{ .URL }}" href="{{ relLangUrl .URL }}"
class="link{{ if .Params.customClass }} {{ .Params.customClass }}{{ end }} {{ $active }}"> class="link{{ if .Params.customClass }} {{ .Params.customClass }}{{ end }} {{ $active }}">
{{ $title := .Title }} {{ $title := .Title }}
{{ with (index site.Params .Identifier) }} {{ with (index site.Params .Identifier) }}