Debian Codegraph @

hugo/layouts/partials/sidebar.html

raw
1 {{- $currentNode := . }}
2 {{- range .Site.Home.Sections.ByWeight}}
3 <ul class="doctree">
4 {{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode}}
5 </ul>
6 {{- end}}
7 {{- define "section-tree-nav" }}
8 {{- $currentNode := .currentnode }}
9 {{- with .sect}}
10 {{- if .IsSection }}
11 <li class="dd-item
12 {{- if .IsAncestor $currentNode}} parent{{end}}
13 {{- if eq .Permalink $currentNode.Permalink}} active{{end}}">
14 {{- $numberOfPages := (add (len .Pages) (len .Sections)) }}
15 {{- if ne $numberOfPages 0 }}
16 {{- if .IsAncestor $currentNode }}
17 <i class="fa liOpened li-item-icon"></i>
18 {{- else -}}
19 <i class="fa liClosed li-item-icon"></i>
20 {{- end}}
21 {{- end}}
22 <a href="{{ .RelPermalink}}"><span>{{ .Title }}</span></a>
23 {{- if ne $numberOfPages 0 }}
24 <ul>
25 {{- $currentNode.Scratch.Set "pages" .Pages }}
26 {{- if .Sections}}
27 {{- $currentNode.Scratch.Set "pages" (.Pages | union .Sections) }}
28 {{- end}}
29 {{- $pages := ($currentNode.Scratch.Get "pages") }}
30 {{- range $pages.ByWeight }}
31 {{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode }}
32 {{- end}}
33 </ul>
34 {{- end}}
35 </li>
36 {{- else}}
37 <li class="dd-item {{- if eq .Permalink $currentNode.Permalink}} active{{end -}}">
38 <i class="fa liSingle li-item-icon"></i>
39 <a href="{{ .RelPermalink }}"><span>{{.Title}}</span> </a>
40 </li>
41 {{- end}}
42 {{- end}}
43 {{- end}}