Skip to content

Commit 6c83df5

Browse files
committed
header: add accesskey (Alt + /) for search
in menu - Alt + /: jumps to search page if in menu
1 parent bccce36 commit 6c83df5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

layouts/partials/header.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,12 @@
111111
{{- range .Site.Menus.main }}
112112
{{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }}
113113
{{- $page_url:= $currentPage.Permalink | absLangURL }}
114+
{{- $is_search := eq ($.Site.GetPage .Name).Layout `search` }}
114115
<li>
115-
<a href="{{ .URL | absLangURL }}" title="{{ .Title | default .Name }}">
116+
<a href="{{ .URL | absLangURL }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}"
117+
{{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}>
116118
<span {{- if eq $menu_item_url $page_url }} class="active" {{- end }}>
117-
{{ .Name }}
119+
{{- .Name -}}
118120
</span>
119121
</a>
120122
</li>

0 commit comments

Comments
 (0)