mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-12-25 15:09:28 -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 := . }}
|
||||
<ul class="menu" id="menu" onscroll="menu_on_scroll()">
|
||||
{{- range .Site.Menus.main }}
|
||||
{{- $menu_item_url := .URL | relLangURL }}
|
||||
{{- $page_url:= $currentPage.RelPermalink | relLangURL }}
|
||||
{{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }}
|
||||
{{- $page_url:= $currentPage.Permalink | absLangURL }}
|
||||
<li>
|
||||
<a href="{{ .URL | absLangURL }}">
|
||||
<span {{- if eq $menu_item_url $page_url }}
|
||||
{{- /* the menu item links to the current page (with relLangURL) */}} class="active" {{- end }}>
|
||||
<a href="{{ $menu_item_url }}">
|
||||
<span {{- if eq $menu_item_url $page_url }} class="active" {{- end }}>
|
||||
{{ .Name }}
|
||||
</span>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user