{{- $contentType := "all"}}
{{- if eq (.Get "type") "section" }}
{{- $contentType = "section" }}
{{- end}}
{{- $depthLimit := 2 }}
{{- with .Get "depth" }}
{{- $depthLimit = . }}
{{- end }}
{{- $startSection := .Page.Page }}
{{- range .Page.Pages }}
{{- template "subsection-loop" dict "startSection" $startSection "currentSection" . "contentType" $contentType "depthLimit" $depthLimit "depthCnt" 0 }}
{{- end }}
{{- define "subsection-loop" }}
{{- $startSection := .startSection }}
{{- $currentSection := .currentSection }}
{{- $contentType := .contentType }}
{{- $depthLimit := .depthLimit }}
{{- $depthCnt := add .depthCnt 1 }}
{{- with .startSection }}