diff options
author | Julien Dessaux | 2023-01-27 23:05:50 +0100 |
---|---|---|
committer | Julien Dessaux | 2023-01-27 23:05:50 +0100 |
commit | 6ad4e164af37e6fe90283a4b9b124c03057d3805 (patch) | |
tree | 2303d0c190d73ab69783718892fbf050f6821baa /layouts/partials | |
parent | Improve link target size on mobile (lighthouse) (diff) | |
download | www-6ad4e164af37e6fe90283a4b9b124c03057d3805.tar.gz www-6ad4e164af37e6fe90283a4b9b124c03057d3805.tar.bz2 www-6ad4e164af37e6fe90283a4b9b124c03057d3805.zip |
Update nav menu css
Diffstat (limited to '')
-rw-r--r-- | layouts/partials/nav.html | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index 5abfc6f..9a63b34 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -1,29 +1,13 @@ <header> <nav> - <ul> - <li class="nav-menu-title{{if .IsHome}} nav-menu-active{{end}}"><a href="/">{{ .Site.Title }}</a></li> - <li> - <select id="themes" class="nav-menu-magin-left" onchange="setTheme()"> - <option value="black-theme">Black</option> - <option value="dark-theme">Dark</option> - <option value="light-theme">Light</option> - </select> + <ol> + <li id="title"{{if .IsHome}} class="nav-menu-active"{{end}}> + <a href="/">{{ .Site.Title }}</a> </li> + </ol> + <ol id="nav-menu"> {{- $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 -}} + {{- range .Site.Menus.main.ByWeight -}} {{- $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}} {{- with .Page -}} {{- $active = or $active ( $.IsDescendant .) -}} @@ -34,6 +18,13 @@ <a href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"{{ if ne $url.Host $baseurl.Host }}target="_blank" {{ end }}>{{ .Name }}</a> </li> {{ end }} - </ul> + <li> + <select id="themes" class="nav-menu-magin-left" onchange="setTheme()"> + <option value="black-theme">Black</option> + <option value="dark-theme">Dark</option> + <option value="light-theme">Light</option> + </select> + </li> + </ol> </nav> </header> |