mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-25 12:01:37 +01:00
header: add accesskey (Alt + /) for search
in menu - Alt + /: jumps to search page if in menu
This commit is contained in:
parent
bccce36c98
commit
6c83df566c
@ -111,10 +111,12 @@
|
|||||||
{{- range .Site.Menus.main }}
|
{{- range .Site.Menus.main }}
|
||||||
{{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }}
|
{{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }}
|
||||||
{{- $page_url:= $currentPage.Permalink | absLangURL }}
|
{{- $page_url:= $currentPage.Permalink | absLangURL }}
|
||||||
|
{{- $is_search := eq ($.Site.GetPage .Name).Layout `search` }}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ .URL | absLangURL }}" title="{{ .Title | default .Name }}">
|
<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 eq $menu_item_url $page_url }} class="active" {{- end }}>
|
||||||
{{ .Name }}
|
{{- .Name -}}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user