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

{{- $toc_id := printf "toc-%s" (replace (urlize .Title) "." "-") -}} {{- $toc := string .TableOfContents }} {{- if ne $toc "" }} {{- safeHTML (replace $toc "TableOfContents" $toc_id) }} {{- end }} {{- else }} {{- template "tree" (dict "page" $page "section" .) }} {{- end }} {{- end }}
{{- end }}
{{- end }}