Toevoegen subitems aan menu's en eenduidige structuur van hoofditems

This commit is contained in:
Michael Boelen 2023-05-17 11:43:44 +02:00
parent 0fb9dabfef
commit 706e8f4627
3 changed files with 27 additions and 4 deletions

View file

@ -6,6 +6,27 @@
url = "/organisatie/"
weight = 10
[[main]]
identifier = "organisatie-doelstellingen"
name = "Doelstellingen"
url = "/organisatie/doelstellingen/"
parent = "organisatie"
weight = 11
[[main]]
identifier = "organisatie-bestuur"
name = "Bestuur"
url = "/organisatie/bestuur/"
parent = "organisatie"
weight = 12
[[main]]
identifier = "organisatie-commissies"
name = "Commissies"
url = "/organisatie/commissies/"
parent = "organisatie"
weight = 13
[[main]]
identifier = "evenementen"
name = "Evenementen"

View file

@ -12,7 +12,9 @@
{{ $pages := (where $.Site.RegularPages ".Section" $sectionName) }}
<ul>
{{ range $pages.ByParam "title" }}
<li><a href="{{ .RelPermalink }}">{{ .Title | default .Site.Params.textNoTitle }}</a></li>
<li>
<a href="{{ .RelPermalink }}">{{ .Title | default .Site.Params.textNoTitle }}</a>
</li>
{{ end }}
</ul>
{{ end }}

View file

@ -14,10 +14,10 @@
<ul class="menus menu">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .Children }}
{{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
{{ if .Children }}
<li>
<button type="button" aria-haspopup="true" aria-expanded="true" aria-controls="dropdown{{ $.Scratch.Get "counter" }}">{{ .Name }}<span class="arrow"></span></button>
<button type="button" aria-haspopup="true" aria-expanded="true" aria-controls="dropdown{{ $.Scratch.Get "counter" }}"><a href="{{ .URL }}">{{ .Name }}</a><!-- <span class="arrow"></span>--></button>
<ul class="dropdown" id="dropdown{{ $.Scratch.Get "counter" }}">
{{ range .Children }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
@ -25,7 +25,7 @@
</ul>
</li>
{{ else }}
<li class="{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a></li>
<li><button type="button" aria-haspopup="true" aria-expanded="true" aria-controls="dropdown{{ $.Scratch.Get "counter" }}"><a href="{{ .URL }}">{{ .Name }}</a></button></li>
{{ end }}
{{ end }}
</ul>