Fixed google's lighthouse seo warnings

missing description meta tag
tap targets too small (menu items did not have margins)
This commit is contained in:
Julien Dessaux 2021-09-13 14:32:52 +02:00
parent 2376690795
commit 53ea0bd15f
3 changed files with 24 additions and 3 deletions

View file

@ -28,4 +28,12 @@ header nav ul li a:hover {
float: left; float: left;
text-transform: uppercase; text-transform: uppercase;
font-weight: 700; font-weight: 700;
margin-right: 4px;
}
.nav-menu-margin-left {
margin-left: 4px;
}
.nav-menu-margins-left-and-right {
margin-left: 4px;
margin-right: 4px;
} }

View file

@ -23,7 +23,7 @@
{{ end -}} {{ end -}}
<title>{{ $title }}</title> <title>{{ $title }}</title>
<meta name="description" content=""> <meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
</head> </head>
<body> <body>
{{- partial "nav.html" . -}} {{- partial "nav.html" . -}}

View file

@ -3,14 +3,27 @@
<ul> <ul>
<li class="nav-menu-title"><a href="/">{{ .Site.Title }}</a></li> <li class="nav-menu-title"><a href="/">{{ .Site.Title }}</a></li>
{{- $p := . -}} {{- $p := . -}}
{{- range .Site.Menus.main.ByWeight -}}
{{- range first 1 .Site.Menus.main.ByWeight -}}
{{- $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}} {{- $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}}
{{- with .Page -}} {{- with .Page -}}
{{- $active = or $active ( $.IsDescendant .) -}} {{- $active = or $active ( $.IsDescendant .) -}}
{{- end -}} {{- end -}}
{{- $url := urls.Parse .URL -}} {{- $url := urls.Parse .URL -}}
{{- $baseurl := urls.Parse $.Site.Params.Baseurl -}} {{- $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> <a href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"{{ if ne $url.Host $baseurl.Host }}target="_blank" {{ end }}>{{ .Name }}</a>
</li> </li>
{{ end }} {{ end }}