Merge pull request #378 from h-enk/collapsible-sidebar

Make id unique collapsible sidebar
This commit is contained in:
Henk Verlinde 2021-07-06 09:05:23 +02:00 committed by GitHub
commit 542bb9a2ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -5,11 +5,11 @@
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}} {{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li class="mb-1"> <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 $active }}true{{ else }}false{{ end }}"> <button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ .Identifier }}" aria-expanded="{{ if $active }}true{{ else }}false{{ end }}">
{{ .Name }} {{ .Name }}
</button> </button>
{{ if .HasChildren -}} {{ if .HasChildren -}}
<div class="collapse{{ if $active }} show{{ end }}" id="{{ .Identifier }}"> <div class="collapse{{ if $active }} show{{ end }}" id="section-{{ .Identifier }}">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small"> <ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
{{ range .Children -}} {{ range .Children -}}
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}}