www/layouts/partials/nav.html
Julien Dessaux 53ea0bd15f Fixed google's lighthouse seo warnings
missing description meta tag
tap targets too small (menu items did not have margins)
2021-09-13 14:32:52 +02:00

32 lines
1.3 KiB
HTML

<header>
<nav>
<ul>
<li class="nav-menu-title"><a href="/">{{ .Site.Title }}</a></li>
{{- $p := . -}}
{{- range first 1 .Site.Menus.main.ByWeight -}}
{{- $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}}
{{- with .Page -}}
{{- $active = or $active ( $.IsDescendant .) -}}
{{- end -}}
{{- $url := urls.Parse .URL -}}
{{- $baseurl := urls.Parse $.Site.Params.Baseurl -}}
<li class="nav-menu-margin-left{{if $active }} nav-menu-active{{end}}">
<a href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"{{ if ne $url.Host $baseurl.Host }}target="_blank" {{ end }}>{{ .Name }}</a>
</li>
{{ end }}
{{- range after 1 .Site.Menus.main.ByWeight -}}
{{- $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}}
{{- with .Page -}}
{{- $active = or $active ( $.IsDescendant .) -}}
{{- end -}}
{{- $url := urls.Parse .URL -}}
{{- $baseurl := urls.Parse $.Site.Params.Baseurl -}}
<li class="nav-menu-margins-left-and-right{{if $active }} nav-menu-active{{end}}">
<a href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"{{ if ne $url.Host $baseurl.Host }}target="_blank" {{ end }}>{{ .Name }}</a>
</li>
{{ end }}
</ul>
</nav>
</header>