{{ with .Site.GetPage (print "/" .Section "/_index.md") }} {{ $.Scratch.Set "haschildren" "" }} {{ range .RegularPages }} {{ $urlparts := split (print .File.Dir .File.BaseFileName) "/" }} {{ range $index, $value := (first (len $urlparts) $urlparts) }} {{ $.Scratch.Add "haschildren" (print " " (delimit (first $index $urlparts) "/") "/") }} {{ end }} {{ end }} {{ $.Scratch.Set "haschildren" (uniq (split ($.Scratch.Get "haschildren") " ")) }} {{ end }}