{{- $out := dict -}} {{- range sort .Site.Sections.ByTitle -}} {{- with .Site.GetPage (print "/" .Section "/_index.md") -}} {{- $children := slice -}} {{- range .RegularPages -}} {{- if .File -}} {{- $urlparts := split (print .File.Dir .File.BaseFileName) "/" -}} {{- range $index, $value := (first (len $urlparts) $urlparts) -}} {{- $children = $children | append (print (delimit (first $index $urlparts) "/") "/") -}} {{- end -}} {{- end -}} {{- end -}} {{- $out = merge $out (dict .Section $children) -}} {{- end -}} {{- end -}} {{- return $out -}}