Skip to content

Commit

Permalink
header: add accesskey (Alt + /) for search
Browse files Browse the repository at this point in the history
in menu

- Alt + /: jumps to search page if in menu
  • Loading branch information
adityatelange committed Dec 18, 2020
1 parent bccce36 commit 6c83df5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@
{{- range .Site.Menus.main }}
{{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }}
{{- $page_url:= $currentPage.Permalink | absLangURL }}
{{- $is_search := eq ($.Site.GetPage .Name).Layout `search` }}
<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 }}>
{{ .Name }}
{{- .Name -}}
</span>
</a>
</li>
Expand Down

0 comments on commit 6c83df5

Please sign in to comment.