menu link is active for being the prefix of current url

This commit is contained in:
Reorx 2022-09-07 12:22:54 +08:00
parent 13a2c8742c
commit 44533c76bb
1 changed files with 1 additions and 1 deletions

View File

@ -133,7 +133,7 @@ function toggleThemeListener() {
<a href="{{ $menu_item_url }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}"
{{- if $is_search -}}data-no-instant{{- end -}}
{{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}
{{- if eq $menu_item_url $page_url }} class="active" {{- end }}
{{- if strings.HasPrefix $page_url $menu_item_url }} class="active" {{- end }}
{{- if .Params.External }} target="_blank" {{- end }}
>
{{- .Pre }}