Commit 44a41db7 authored by Henk Verlinde's avatar Henk Verlinde
Browse files

feat: add multi level section menu

parent 4f936518
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ lastMod = false
  flexSearch = true
  darkMode = true
  bootStrapJs = true
  breadCrumb = false
  breadCrumb = true
  highLight = true
  kaTex = false
  collapsibleSidebar = true
+57 −98
Original line number Diff line number Diff line
<aside>
  <ul class="list-unstyled collapsible-sidebar">
      {{ $currentPage := . }}
      {{ range .Site.Menus.docs }}
          {{ if .HasChildren }}
              <li class="{{ if $currentPage.HasMenuCurrent "docs" . }}active{{ end }}">
                  <a href="#">
                      {{ .Pre }}
                      <span>{{ .Name }}</span>
                  </a>
              </li>
              <ul class="sub-menu">
                  {{ range .Children }}


                    {{ if .HasChildren }}
                        <li class="{{ if $currentPage.HasMenuCurrent "docs" . }}active{{ end }}">
                            <a href="#">
                                {{ .Pre }}
                                <span>{{ .Name }}</span>
                            </a>
                        </li>
                        <ul class="sub-menu">
                            {{ range .Children }}


                                {{ if .HasChildren }}
                                    <li class="{{ if $currentPage.HasMenuCurrent "docs" . }}active{{ end }}">
                                        <a href="#">
                                            {{ .Pre }}
                                            <span>{{ .Name }}</span>
                                        </a>
                                    </li>
                                    <ul class="sub-menu">
                                        {{ range .Children }}
                                            <li class="{{ if $currentPage.IsMenuCurrent "docs" . }}active{{ end }}">
                                                <a href="{{ .URL }}">{{ .Name }}</a>
                                            </li>
                                        {{ end }}
                                    </ul>
                                {{ else }}
                                    <li>
                                        <a href="{{ .URL }}">
                                            {{ .Pre }}
                                            <span>{{ .Name }}</span>
                                        </a>
                                    </li>
                                {{ end }}


                            {{ end }}
                        </ul>
                    {{ else }}
                        <li>
                            <a href="{{ .URL }}">
                                {{ .Pre }}
                                <span>{{ .Name }}</span>
                            </a>
                        </li>
                    {{ end }}



                  {{ end }}
              </ul>
          {{ else }}
              <li>
                  <a href="{{ .URL }}">
                      {{ .Pre }}
                      <span>{{ .Name }}</span>
                  </a>
              </li>
          {{ end }}
      {{ end }}
  </ul>
</aside>

<!--
{{ if .Site.Params.options.collapsibleSidebar -}}
  <ul class="list-unstyled collapsible-sidebar">
    {{ $currentPage := . -}}
@@ -90,10 +12,48 @@
          <div class="collapse{{ if $active }} show{{ end }}" id="section-{{ .Identifier }}">
            <ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
              {{ range .Children -}}
                {{ if .HasChildren -}}
                  <li class="my-1 ms-3">
                    <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 }}
                    </button>
                    {{ if .HasChildren -}}
                      <div class="collapse{{ if $active }} show{{ end }}" id="section-{{ .Identifier }}">
                        <ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
                          {{ range .Children -}}
                            {{ if .HasChildren -}}
                              <li class="my-1 ms-3">
                                <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 }}
                                </button>
                                {{ if .HasChildren -}}
                                  <div class="collapse{{ if $active }} show{{ end }}" id="section-{{ .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>
                            {{ else -}}
                              {{- $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 -}}
                          {{ end -}}
                        </ul>
                      </div>
                    {{ end -}}
                  </li>
                {{ else -}}
                  {{- $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 -}}
              {{ end -}}
            </ul>
          </div>
        {{ end -}}
@@ -115,4 +75,3 @@
    {{ end -}}
  {{ end -}}
{{ end -}}
-->