1 |
efrain |
1 |
{{$currentNode := .}}
|
|
|
2 |
<nav id="docssidebar" class="collapse d-md-block docs-sidebar" aria-label="Component Library Navigation">
|
|
|
3 |
<ul>
|
|
|
4 |
{{- if eq .Site.Params.ordersectionsby "title" -}}
|
|
|
5 |
{{- range .Site.Home.Sections.ByTitle -}}
|
|
|
6 |
{{template "docs-sidebar" dict "sect" . "currentnode" $currentNode}}
|
|
|
7 |
{{- end -}}
|
|
|
8 |
{{- else -}}
|
|
|
9 |
{{- range .Site.Home.Sections.ByWeight -}}
|
|
|
10 |
{{template "docs-sidebar" dict "sect" . "currentnode" $currentNode}}
|
|
|
11 |
{{- end -}}
|
|
|
12 |
{{- end}}
|
|
|
13 |
</ul>
|
|
|
14 |
</nav>
|
|
|
15 |
|
|
|
16 |
{{define "docs-sidebar"}}
|
|
|
17 |
{{- $currentNode := .currentnode -}}
|
|
|
18 |
{{ with .sect }}
|
|
|
19 |
{{ if .IsSection }}
|
|
|
20 |
{{ if in .Site.Params.menu_exclusion .Section }}
|
|
|
21 |
{{- else -}}
|
|
|
22 |
{{- safeHTML .Params.head -}}
|
|
|
23 |
{{- $numberOfPages := (add (len .Pages) (len .Sections)) -}}
|
|
|
24 |
<li class="{{ if .IsAncestor $currentNode }}parent{{ end }}{{ if and .File $currentNode.File }}{{ if eq .File.UniqueID $currentNode.File.UniqueID }} active{{ end }}{{ end }}{{ if .Params.alwaysopen }} parent{{ end }}"><a href="{{ if .IsPage }}{{ .Permalink }}{{ else}}#{{ end }}" data-toggle="collapse" data-target="#collapse{{ .File.UniqueID }}" aria-expanded="true" aria-controls="collapse{{ .File.UniqueID }}" class="dropdown-toggle"><div class="text-truncate">{{ safeHTML .Params.Pre }}{{ .Title }}{{ safeHTML .Params.Post }}</div></a>
|
|
|
25 |
{{ if ne $numberOfPages 0 }}
|
|
|
26 |
<ul id="collapse{{ .File.UniqueID }}" class="sub-menu collapse {{ if .IsAncestor $currentNode }}show{{ end }}">
|
|
|
27 |
{{- .Scratch.Set "pages" .Pages -}}
|
|
|
28 |
{{- if .Sections -}}
|
|
|
29 |
{{- .Scratch.Set "pages" (.Pages | union .Sections) -}}
|
|
|
30 |
{{- end -}}
|
|
|
31 |
{{- $pages := (.Scratch.Get "pages") -}}
|
|
|
32 |
{{- if eq .Site.Params.ordersectionsby "title" -}}
|
|
|
33 |
{{- range $pages.ByTitle -}}
|
|
|
34 |
{{- if and .Params.hidden (not $.showhidden) -}}
|
|
|
35 |
{{- else -}}
|
|
|
36 |
{{template "docs-sidebar" dict "sect" . "currentnode" $currentNode}}
|
|
|
37 |
{{- end -}}
|
|
|
38 |
{{- end -}}
|
|
|
39 |
{{- else -}}
|
|
|
40 |
{{- range $pages.ByWeight -}}
|
|
|
41 |
{{- if and .Params.hidden (not $.showhidden) -}}
|
|
|
42 |
{{- else -}}
|
|
|
43 |
{{template "docs-sidebar" dict "sect" . "currentnode" $currentNode}}
|
|
|
44 |
{{- end -}}
|
|
|
45 |
{{- end -}}
|
|
|
46 |
{{- end}}
|
|
|
47 |
</ul>
|
|
|
48 |
{{end}}
|
|
|
49 |
</li>
|
|
|
50 |
{{- end -}}
|
|
|
51 |
{{- else -}}
|
|
|
52 |
{{- if not .Params.Hidden -}}
|
|
|
53 |
<li class="{{ if and .File $currentNode.File }}{{ if eq .File.UniqueID $currentNode.File.UniqueID }}active{{ end }}{{ end }}"><a href="{{ if .IsPage }}{{ .Permalink }}{{ end }}">{{ safeHTML .Params.Pre }}{{ .Title }}{{ safeHTML .Params.Post }}</a></li>
|
|
|
54 |
{{- end -}}
|
|
|
55 |
{{ end -}}
|
|
|
56 |
{{ end -}}
|
|
|
57 |
{{ end }}
|