🐛 Fix menu localization: site.Menus URLs are already localized

This commit is contained in:
Nicolas PELLEGRIN 2024-10-21 16:32:30 +02:00
parent a2eb47bb4b
commit 58df123500

View File

@ -122,11 +122,11 @@
{{- $currentPage := . }} {{- $currentPage := . }}
<ul id="menu"> <ul id="menu">
{{- range site.Menus.main }} {{- range site.Menus.main }}
{{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }} {{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) }}
{{- $page_url:= $currentPage.Permalink | absLangURL }} {{- $page_url:= $currentPage.Permalink }}
{{- $is_search := eq (site.GetPage .KeyName).Layout `search` }} {{- $is_search := eq (site.GetPage .KeyName).Layout `search` }}
<li> <li>
<a href="{{ .URL | absLangURL }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}" <a href="{{ .URL }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}"
{{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}> {{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}>
<span {{- if eq $menu_item_url $page_url }} class="active" {{- end }}> <span {{- if eq $menu_item_url $page_url }} class="active" {{- end }}>
{{- .Pre }} {{- .Pre }}