mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-12-26 07:29:27 -05:00
header: improve menu location indicator
- fix non-highlight on subdirs - menu url need not have leading or trailing slashes - fix non-highlight with multilingual config
This commit is contained in:
parent
dc743ae5e2
commit
7a0e742def
@ -109,12 +109,11 @@
|
|||||||
{{- $currentPage := . }}
|
{{- $currentPage := . }}
|
||||||
<ul class="menu" id="menu" onscroll="menu_on_scroll()">
|
<ul class="menu" id="menu" onscroll="menu_on_scroll()">
|
||||||
{{- range .Site.Menus.main }}
|
{{- range .Site.Menus.main }}
|
||||||
{{- $menu_item_url := .URL | relLangURL }}
|
{{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }}
|
||||||
{{- $page_url:= $currentPage.RelPermalink | relLangURL }}
|
{{- $page_url:= $currentPage.Permalink | absLangURL }}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ .URL | absLangURL }}">
|
<a href="{{ $menu_item_url }}">
|
||||||
<span {{- if eq $menu_item_url $page_url }}
|
<span {{- if eq $menu_item_url $page_url }} class="active" {{- end }}>
|
||||||
{{- /* the menu item links to the current page (with relLangURL) */}} class="active" {{- end }}>
|
|
||||||
{{ .Name }}
|
{{ .Name }}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user