portails/layouts/partials/sidebar/docs-menu.html

39 lines
1.7 KiB
HTML

{{ if .Site.Params.options.collapsibleSidebar -}}
<ul class="list-unstyled collapsible-sidebar">
{{ $currentPage := . -}}
{{ range $index, $value := .Site.Menus.docs -}}
<li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#{{ .Identifier }}" aria-expanded="{{ if not $index }}true{{ else }}false{{ end }}">
{{ .Name }}
</button>
{{ if .HasChildren -}}
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<div class="collapse{{ if $active }} show{{ end }}" id="{{ .Identifier }}">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
{{ range .Children -}}
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
{{ end -}}
</ul>
</div>
{{ end -}}
</li>
{{ end -}}
</ul>
{{ else -}}
{{ $currentPage := . -}}
{{ range .Site.Menus.docs -}}
<h3>{{ .Name }}</h3>
{{ if .HasChildren -}}
<ul class="list-unstyled">
{{ 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 -}}
{{ end -}}
{{ end -}}