feat: add manual multi level default section menu
This commit is contained in:
parent
f0edb03105
commit
3e384f393d
|
@ -92,7 +92,6 @@ mainSections = ["docs"]
|
||||||
docsVersioning = false
|
docsVersioning = false
|
||||||
|
|
||||||
[menu]
|
[menu]
|
||||||
|
|
||||||
[menu.section]
|
[menu.section]
|
||||||
auto = false
|
auto = true
|
||||||
collapsibleSidebar = false
|
collapsibleSidebar = true
|
||||||
|
|
|
@ -125,15 +125,41 @@
|
||||||
<!-- Manual default section menu, single level -->
|
<!-- Manual default section menu, single level -->
|
||||||
{{ $currentPage := . -}}
|
{{ $currentPage := . -}}
|
||||||
{{ range .Site.Menus.docs -}}
|
{{ range .Site.Menus.docs -}}
|
||||||
<h3 class="h6 text-uppercase">{{ .Name }}</h3>
|
<h3 class="h6 text-uppercase mb-2">{{ .Name }}</h3>
|
||||||
{{ if .HasChildren -}}
|
{{ if .HasChildren -}}
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
{{ range .Children -}}
|
{{ range .Children -}}
|
||||||
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}}
|
{{ if .HasChildren -}}
|
||||||
{{- $active = or $active (eq $currentPage.Section .Identifier) -}}
|
<h4 class="h6 text-uppercase ms-3 mt-3 mb-2">{{ .Name }}</h4>
|
||||||
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
|
{{ if .HasChildren -}}
|
||||||
{{ end -}}
|
<ul class="list-unstyled ms-3">
|
||||||
</ul>
|
{{ range .Children -}}
|
||||||
|
{{ if .HasChildren -}}
|
||||||
|
<h5 class="h6 text-uppercase mt-2 mb-2">{{ .Name }}</h5>
|
||||||
|
{{ if .HasChildren -}}
|
||||||
|
<ul class="list-unstyled ms-3">
|
||||||
|
{{ range .Children -}}
|
||||||
|
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}}
|
||||||
|
{{- $active = or $active (eq $currentPage.Section .Identifier) -}}
|
||||||
|
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
|
||||||
|
{{ end -}}
|
||||||
|
</ul>
|
||||||
|
{{ end -}}
|
||||||
|
{{ else -}}
|
||||||
|
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}}
|
||||||
|
{{- $active = or $active (eq $currentPage.Section .Identifier) -}}
|
||||||
|
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
</ul>
|
||||||
|
{{ end -}}
|
||||||
|
{{ else -}}
|
||||||
|
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}}
|
||||||
|
{{- $active = or $active (eq $currentPage.Section .Identifier) -}}
|
||||||
|
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
</ul>
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|
Loading…
Reference in New Issue