feat: add auto default section menu
This commit is contained in:
parent
0e8cd3c320
commit
9e5ef02e7a
|
@ -90,5 +90,5 @@ lastMod = false
|
||||||
[menu]
|
[menu]
|
||||||
[menu.section]
|
[menu.section]
|
||||||
auto = true
|
auto = true
|
||||||
collapsibleSidebar = true
|
collapsibleSidebar = false
|
||||||
mainSections = ["docs", "tutorial"]
|
mainSections = ["docs"]
|
||||||
|
|
|
@ -1 +1,36 @@
|
||||||
<!-- Auto default section menu, single level -->
|
<!-- Auto default section menu, single level -->
|
||||||
|
{{ $currentPage := . -}}
|
||||||
|
{{ range (where .Site.Sections "Section" "in" site.Params.menu.section.mainSections) }}
|
||||||
|
{{ range .Sections.Reverse }}
|
||||||
|
{{ $active := in $currentPage.RelPermalink .RelPermalink }}
|
||||||
|
<h3 class="h6 text-uppercase mb-2">{{ .Title }}</h3>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
{{ range .Pages }}
|
||||||
|
{{ if .IsNode }}
|
||||||
|
{{ $active := in $currentPage.RelPermalink .RelPermalink }}
|
||||||
|
<h4 class="h6 text-uppercase ms-3 mt-3 mb-2">{{ .Title }}</h4>
|
||||||
|
<ul class="list-unstyled ms-3">
|
||||||
|
{{ range .Pages }}
|
||||||
|
{{ if .IsNode }}
|
||||||
|
{{ $active := in $currentPage.RelPermalink .RelPermalink }}
|
||||||
|
<h5 class="h6 text-uppercase mt-2 mb-2">{{ .Title }}</h5>
|
||||||
|
<ul class="list-unstyled ms-3">
|
||||||
|
{{ range .Pages }}
|
||||||
|
{{ $active := in $currentPage.RelPermalink .RelPermalink }}
|
||||||
|
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
{{ else }}
|
||||||
|
{{ $active := in $currentPage.RelPermalink .RelPermalink }}
|
||||||
|
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
{{ else }}
|
||||||
|
{{ $active := in $currentPage.RelPermalink .RelPermalink }}
|
||||||
|
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
Loading…
Reference in New Issue