diff options
author | Martijn Cuppens <martijn.cuppens@gmail.com> | 2020-07-03 16:16:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-03 16:16:05 +0300 |
commit | 7cedb8eeae669e749ed5087e8bd025aa6e58626f (patch) | |
tree | 0197c56416e6ca25d5ebbe20cfbd85788f4adfc5 /site/layouts | |
parent | 10690dd31778fa5114d9c357867d8c7bea597bc0 (diff) |
Fix sidebar jump (#31232)
Diffstat (limited to 'site/layouts')
-rw-r--r-- | site/layouts/partials/docs-sidebar.html | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/site/layouts/partials/docs-sidebar.html b/site/layouts/partials/docs-sidebar.html index 6a665b826b..8fd77361f5 100644 --- a/site/layouts/partials/docs-sidebar.html +++ b/site/layouts/partials/docs-sidebar.html @@ -2,7 +2,7 @@ {{- $url := split .Permalink "/" -}} {{- $page_slug := index $url (sub (len $url) 2) -}} - <ul class="list-unstyled mb-0"> + <ul class="list-unstyled mb-0 pt-1 pb-3"> {{- range $group := .Site.Data.sidebar -}} {{- $link := $group.title -}} {{- $link_slug := $link | urlize -}} @@ -15,20 +15,22 @@ {{- $group_slug := $group.title | urlize -}} {{- $is_active_group := eq $.Page.Params.group $group_slug }} - <li class="my-1{{ if $is_active_group }} active{{ end }}"> + <li class="mb-1{{ if $is_active_group }} active{{ end }}"> <a class="d-inline-flex align-items-center rounded{{ if not $is_active_group }} collapsed{{ end }}" data-toggle="collapse" href="#{{ $group_slug }}-collapse" role="button" aria-expanded="{{ $is_active_group }}"{{ if $is_active_group }} aria-current="true"{{ end }}> {{ $group.title }} </a> {{- if $group.pages }} - <ul class="list-unstyled font-weight-normal mb-2 collapse{{ if $is_active_group }} show{{ end }}" id="{{ $group_slug }}-collapse"> - {{- range $doc := $group.pages -}} - {{- $doc_slug := $doc.title | urlize -}} - {{- $is_active := and $is_active_group (eq $page_slug $doc_slug) -}} - {{- $href := printf "/docs/%s/%s/%s/" $.Site.Params.docs_version $group_slug $doc_slug }} - <li><a href="{{ $href }}" class="d-inline-flex align-items-center rounded{{ if $is_active }} active{{ end }}"{{ if $is_active }} aria-current="page"{{ end }}>{{ $doc.title }}</a></li> - {{- end }} - </ul> + <div class="collapse{{ if $is_active_group }} show{{ end }}" id="{{ $group_slug }}-collapse"> + <ul class="list-unstyled font-weight-normal pb-1 small"> + {{- range $doc := $group.pages -}} + {{- $doc_slug := $doc.title | urlize -}} + {{- $is_active := and $is_active_group (eq $page_slug $doc_slug) -}} + {{- $href := printf "/docs/%s/%s/%s/" $.Site.Params.docs_version $group_slug $doc_slug }} + <li><a href="{{ $href }}" class="d-inline-flex align-items-center rounded{{ if $is_active }} active{{ end }}"{{ if $is_active }} aria-current="page"{{ end }}>{{ $doc.title }}</a></li> + {{- end }} + </ul> + </div> {{- end }} </li> {{- end }} |