22{{ $currentPage := .currentPage }}
33{{ $firstSection := .firstSection }}
44{{ $idPrefix := .idPrefix }}
5-
65{{ with $firstSection }}
76< ul class ="sidebar__ul ">
87 {{ $pages := .Pages.ByWeight }}
98 {{ range $index, $p := $pages }}
109 {{- $onPage := eq $currentUrl $p.Permalink -}}
1110 {{- $isAncestor := $p.IsAncestor $currentPage -}}
1211 {{- $shouldExpand := or $onPage $isAncestor -}}
13- {{/* These variables are used to create a unique id to be attached to every link
14- that accessibility users can correctly "Skip Table Of Contents" */}}
1512 {{- $sectionID := printf "%ssection-%s" $idPrefix (urlize $p.Permalink) -}}
1613 {{- $linkID := printf "%slink-%s" $idPrefix (urlize $p.Permalink) -}}
1714 {{- $nextIndex := add $index 1 -}}
1815 {{- $nextLink := index $pages $nextIndex -}}
19-
2016 {{ if eq $p.Kind "section" }}
2117 < li class ="sidebar__section ">
2218 < button
3531 class ="sidebar__children "
3632 {{ if not $shouldExpand }}hidden{{ end }}
3733 >
34+ {{ if and .Content (gt (len .Pages) 0) }}
35+ < ul >
36+ < li class ="sidebar__page ">
37+ < a
38+ href ="{{ $p.Permalink }} "
39+ class ="sidebar__link {{ if $onPage }}sidebar__link--current{{ end }} "
40+ {{ if $onPage }}aria-current ="page "{{ end }}
41+ >
42+ Overview
43+ </ a >
44+ </ li >
45+ </ ul >
46+ {{ end }}
47+
3848 {{ partial "sidebar-list.html" (dict
3949 "firstSection" $p
4050 "currentUrl" $currentUrl
4353 ) }}
4454 </ div >
4555 </ li >
46-
4756 {{ else if eq $p.Kind "page" }}
4857 {{- $tocHasItems := (in $p.TableOfContents "< li > ") -}}
4958 {{- $pageHasTOC := (and $onPage $tocHasItems $p.Params.toc) -}}
8291 {{ end }}
8392 </ li >
8493 {{ end }}
85-
8694 {{ end }}
8795</ ul >
88- {{ end }}
89-
90- {{/* {{ if gt (.WordCount) 0 }}
91- < ul >
92- < li >
93- < a href ="{{ .Permalink }} " style ="color: purple; {{if $onPage}}font-weight: bold;{{end}} "> {{ .Title }} - Overview</ a >
94- </ li >
95- </ ul >
96- {{ end }} */}}
96+ {{ end }}
0 commit comments