mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-10 00:12:09 +00:00
83b4f32d0b
WCAG recommends telling visitors about their current place in a site's hierarchy. All pages are exactly zero or one level below a section, so simply emphasizing a member of the navigation links should be sufficient.
23 lines
1 KiB
HTML
23 lines
1 KiB
HTML
<header id="banner" itemscope itemtype="https://schema.org/WPHeader">
|
|
<a href="#content" class="skip">Skip to content</a>
|
|
<nav aria-label="Main navigation">
|
|
<ul class="unstyled-list">
|
|
{{- $currentPage := . -}}
|
|
<li itemscope itemtype="https://schema.org/SiteNavigationElement">
|
|
<a rel="home" itemprop="url" href="{{ .Site.BaseURL }}"{{- if eq $currentPage.Permalink .Site.BaseURL -}} aria-current="page"{{- end -}}><span itemprop="name">{{ .Site.Title }}</span></a>
|
|
</li>
|
|
{{ range .Site.Menus.main -}}
|
|
{{ $isCurrent := false }}
|
|
<li itemscope itemtype="https://schema.org/SiteNavigationElement">
|
|
<a href="{{ .URL }}" itemprop="url" {{- if or (eq $currentPage.RelPermalink .URL) ($currentPage.HasMenuCurrent "main" .) -}}{{- $isCurrent = true -}} aria-current="page"{{- end -}}>
|
|
{{- if or $isCurrent (eq $currentPage.Section .Title) -}}
|
|
<strong itemprop="name">{{- .Name -}}</strong>
|
|
{{- else -}}
|
|
<span itemprop="name">{{- .Name -}}</span>
|
|
{{- end -}}
|
|
</a>
|
|
</li>
|
|
{{- end }}
|
|
</ul>
|
|
</nav>
|
|
</header>
|