7
0
Fork 0

Ondersteuning voor meerdere submenu's dmv counter en eigen id

This commit is contained in:
Michael Boelen 2023-05-17 10:43:39 +02:00
parent 5a2faae224
commit f32e40c375

View file

@ -1,3 +1,6 @@
{{ $.Scratch.Set "counter" 0 }}
{{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
<header> <header>
<div class="header-content"> <div class="header-content">
@ -12,9 +15,10 @@
{{ $currentPage := . }} {{ $currentPage := . }}
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
{{ if .Children }} {{ if .Children }}
{{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
<li> <li>
<button type="button" aria-haspopup="true" aria-expanded="true" aria-controls="dropdown1">{{ .Name }}<span class="arrow"></span></button> <button type="button" aria-haspopup="true" aria-expanded="true" aria-controls="dropdown{{ $.Scratch.Get "counter" }}">{{ .Name }}<span class="arrow"></span></button>
<ul class="dropdown" id="dropdown1"> <ul class="dropdown" id="dropdown{{ $.Scratch.Get "counter" }}">
{{ range .Children }} {{ range .Children }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li> <li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }} {{ end }}