{{- template "tree" (dict "page" . "section" .FirstSection) }} {{- define "tree" }} {{- $section := .section }} {{- $page := .page }} {{- $permalink := $page.RelPermalink }}

{{ $section.Title }}

{{- $pages := $section.Pages }} {{- with $pages }}
{{- range . }} {{- if .IsPage }}

{{ .Title }}

{{- if ne (print .TableOfContents) ""}} {{- .TableOfContents }} {{- end }} {{- else }} {{- template "tree" (dict "page" $page "section" .) }} {{- end }} {{- end }}
{{- end }}
{{- end }}