ensure menu item url has / suffix
This commit is contained in:
parent
3398b4c6ab
commit
3b964af770
|
@ -117,11 +117,11 @@ window.addEventListener('toggle-theme', function() {
|
||||||
{{- $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) ) | absURL }}
|
{{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL)) | absURL }}
|
||||||
{{- $page_url:= $currentPage.Permalink | absURL }}
|
{{- $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 | absURL }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}"
|
<a href="{{ $menu_item_url }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}"
|
||||||
{{- if $is_search -}}data-no-instant{{- end -}}
|
{{- if $is_search -}}data-no-instant{{- end -}}
|
||||||
{{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}
|
{{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}
|
||||||
{{- if eq $menu_item_url $page_url }} class="active" {{- end }}
|
{{- if eq $menu_item_url $page_url }} class="active" {{- end }}
|
||||||
|
|
Loading…
Reference in New Issue