SandpointsTheme/layouts/partials/GetSectionsWithPagePaths.html

13 lines
504 B
HTML

{{- $menus := dict -}}
{{- $sections := slice -}}
{{- range $pagePath := . -}}
{{- with site.GetPage $pagePath -}}
{{- $section := .Section -}}
{{- $menu := index $menus $section|default slice -}}
{{- $menu = uniq ($menu | append $pagePath) -}}
{{- $menus = merge $menus (dict $section $menu) -}}
{{- $sections = $sections | append $section -}}
{{- end -}}
{{- end -}}
{{- $menus = merge $menus (dict "sections" ($sections|uniq)) -}}
{{- return $menus -}}