fix docs menu depth collapsing

This commit is contained in:
a 2022-12-11 18:48:40 -06:00
parent 317e9651c9
commit 73d11f00b8

View file

@ -10,63 +10,44 @@
{{ $currentPage := . }}
{{ range .Site.Menus.docs }}
{{ $active := or ($currentPage.IsMenuCurrent "docs" .) (eq $currentPage.Section .Identifier)}}
<details class='section-title{{- if $active }} active{{ end -}}' {{- if $active }} open{{ end -}}>
{{ if .HasChildren }}
<details
class='section-title
{{- if $active }} active{{ end -}}
'
{{- if $active }} open{{ end -}}>
<summary href="{{ .URL | relLangURL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
{{ .Post }}
{{ .Pre }}<span>{{ .Name }}</span>{{ .Post }}
</summary>
<ul class="sub-menu">
<ul class="sub-menu" data-depth=1>
{{ range .Children }}
{{ if .HasChildren}}
<li
class='{{- if $active }} active{{ end -}}'>
<li class='{{- if $active }} active{{ end -}}'>
<a href="{{ .URL | relLangURL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
{{ .Post }}
{{ .Pre }}<span>{{ .Name }}</span>{{ .Post }}
</a>
<ul class="sub-menu">
<ul class="sub-menu" data-depth=2>
{{ range .Children }}
<li
class='{{- if $active }} active{{ end -}}'>
<li class='{{- if $active }} active{{ end -}}'>
<a href="{{ .URL | relLangURL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
{{ .Post }}
{{ .Pre }}<span>{{ .Name }}</span>{{ .Post }}
</a>
</li>
{{ end }}{{/* range .Children (subsubmenu) */}}
</ul>
{{ else }}{{/* not .HasChildren (subsubmenu) */}}
<li class='{{- if $active }} active{{ end -}}'>
<a href="{{ .URL | relLangURL }}">
{{ .Pre }}<span>{{ .Name }}</span>{{ .Post }}
</a>
</li>
{{ end }}{{/* range .Children */}}
{{ end }}
</ul>
{{ else }}
<li class='{{- if $active }} active{{ end -}}'>
<a href="{{ .URL | relLangURL }}">
{{ .Pre }}<span>{{ .Name }}</span>{{ .Post }}
</a>
</li>
{{ end }}
</ul>
</details>
{{ else }}
<li
class='{{- if $active }} active{{ end -}}'>
<a href="{{ .URL | relLangURL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
{{ .Post }}
</a>
</li>
{{ end }}
{{ end }}
</ul>
</li>
{{ else }}
<li
class='{{- if $active }} active{{ end -}}'>
<a href="{{ .URL | relLangURL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
{{ .Post }}
</a>
</li>
{{ end }}
{{ end }}
</ul>
</div>