aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/nav.html
diff options
context:
space:
mode:
authorJulien Dessaux2021-09-13 14:32:52 +0200
committerJulien Dessaux2021-09-13 14:32:52 +0200
commit53ea0bd15fa2281b040d191a5efc16266b54e0de (patch)
tree1ca1d964bb5b5202e55394127bf95d59d446a910 /layouts/partials/nav.html
parentTags overhaul to improve search results, and some light rewording or reformating (diff)
downloadwww-53ea0bd15fa2281b040d191a5efc16266b54e0de.tar.gz
www-53ea0bd15fa2281b040d191a5efc16266b54e0de.tar.bz2
www-53ea0bd15fa2281b040d191a5efc16266b54e0de.zip
Fixed google's lighthouse seo warnings
missing description meta tag tap targets too small (menu items did not have margins)
Diffstat (limited to 'layouts/partials/nav.html')
-rw-r--r--layouts/partials/nav.html17
1 files changed, 15 insertions, 2 deletions
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index 109f687..eeec5f2 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -3,14 +3,27 @@
<ul>
<li class="nav-menu-title"><a href="/">{{ .Site.Title }}</a></li>
{{- $p := . -}}
- {{- range .Site.Menus.main.ByWeight -}}
+
+ {{- 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{{if $active }} class="nav-menu-active"{{end}}>
+ <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 }}