wip menu system

This commit is contained in:
rra 2021-10-19 23:58:19 +02:00
parent f3853c4bf9
commit 657bb5305f

View File

@ -2,11 +2,33 @@
<h1 class="logo"><a href="/"><img src="{{ .Site.Params.logo }}" alt="{{ .Site.Title }}"/></a></h1>
<nav class="menu">
<ul>
{{ with .Site.Menus.main }}
{{ range . }}
<li class="menu-nav-item"> <a href="{{ .URL | relURL }}" title="{{ .Title }}">{{ .Name }}</a>
{{ end }}
{{ end }}
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<details class="menu-dropdown">
<summary class="menu-nav-item {{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}">
<a href="#">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</summary>
<ul class="sub-menu">
{{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
</details>
{{ else }}
<li class="menu-nav-item">
<a href="{{ .URL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
{{ end }}
{{ end }}
</ul>
</nav>
</header>