mark nav item as active for sub-pages

When navigating to e.g. a single blog page, the nav item this page is
in is now marked as active so users know in which area of the site
they are navigating at the moment.
This commit is contained in:
Max Jonas Werner 2022-05-23 14:52:36 +02:00
parent 54a3c60735
commit 13d9b3842e
No known key found for this signature in database
GPG Key ID: EB525E0F02B52140

View File

@ -108,7 +108,7 @@
<li>
<a href="{{ .URL | absLangURL }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}"
{{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}>
<span {{- if eq $menu_item_url $page_url }} class="active" {{- end }}>
<span {{- if hasPrefix $page_url $menu_item_url }} class="active" {{- end }}>
{{- .Pre }}
{{- .Name -}}
{{ .Post -}}