Raw
 1{{ define "main" }}
 2  <div class="title depth-0"><span class="supt">Sitemap⁄{{ substr site.Title 0 1 }}</span>{{ substr site.Title 1 }}{{ with .Section }} ({{ . }}/){{ end }}</div>
 3  {{- $graph := partialCached "graph.html" site site.Language.Lang -}}
 4  {{- $shown := newScratch -}}
 5  {{- $section := .Section -}}
 6  {{- range where site.Pages "Kind" "in" (slice "page" "section") -}}
 7    {{- $entry := index $graph.pages .Path -}}
 8    {{- if and (eq $entry.depth 0) $entry.children -}}
 9      {{- partial "sitemap-entry.html" (dict "page" . "section" $section "remaining" 2 "shown" $shown) -}}
10    {{- end -}}
11  {{- end -}}
12  {{- range site.RegularPages -}}
13    {{- if not ($shown.Get .Path) -}}
14      {{- partial "sitemap-entry.html" (dict "page" . "section" $section "remaining" 0 "shown" $shown) -}}
15    {{- end -}}
16  {{- end -}}
17{{ end }}