blob: 94ff26f13e65e401ac49e268af816651495be3fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
{{- $sortTerm := .Get "sort" | default "Weight" }}
{{- .Scratch.Set "current" .Page }}
{{- if (.Get "page")}}
{{- with .Site.GetPage "section" (.Get "page") }}
{{- $.Scratch.Set "current" . }}
{{- end }}
{{- end }}
{{- $cpage := (.Scratch.Get "current") }}
<ul class="docs-children list-unstyled">
{{- .Scratch.Set "pages" $cpage.Pages }}
{{- if $cpage.Sections}}
{{- .Scratch.Set "pages" ($cpage.Pages | union $cpage.Sections) }}
{{- end}}
{{- $pages := (.Scratch.Get "pages") }}
{{- if eq $sortTerm "Weight"}}
{{- template "childs" dict "menu" $pages.ByWeight "pages" .Site.Pages "sortTerm" $sortTerm}}
{{end}}
</ul>
{{ define "childs" }}
{{- range .menu }}
<li class="h2 py-1">
<a href="{{.RelPermalink}}"> {{ .Title }} </a>
</li>
{{ end }}
{{ end }}
|