Skip to content

Commit

Permalink
Expand docs menu by default
Browse files Browse the repository at this point in the history
This commit makes the docs menus expanded by default instead of
collapsed by default, for two reasons:

1. We don't actually have many pages in the docs section, so there's no
   need to save space.
2. Expanding by default makes the site more functional with JS disabled.
  • Loading branch information
frawleyskid committed Oct 19, 2023
1 parent d8b46e9 commit 0235558
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions layouts/partials/sidebar/docs-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
<ul class="list-unstyled collapsible-sidebar">
{{ $currentPage := . -}}
{{ range $index, $element := .Site.Menus.docs -}}
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li class="mb-1">
<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 }}">
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ .Identifier }}" aria-expanded="true">
{{ .Name }}
</button>
{{ if .HasChildren -}}
<div class="collapse{{ if $active }} show{{ end }}" id="section-{{ .Identifier }}">
<div class="collapse show" 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" .) -}}
Expand All @@ -36,4 +34,4 @@ <h3 class="h6 text-uppercase">{{ .Name }}</h3>
</ul>
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}

0 comments on commit 0235558

Please sign in to comment.