fime/themes/ace-documentation/layouts/shortcodes/childpages.html
2022-09-28 21:20:15 +02:00

34 lines
803 B
HTML

{{- $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 }}