1{{- $currentPage := .currentPage -}}
2{{- $skipPeople := .skipPeople -}}
3{{- $graph := (index (partialCached "graph.html" site site.Language.Lang).pages $currentPage.Path).forward -}}
4{{- $allSections := slice -}}
5{{- $menuPagePaths := dict -}}
6{{ range $menuPrefix, $pagePath := $graph }}
7 {{- if eq $menuPrefix "no-prefix" -}}
8 {{- $sectionsWithPagePaths := partial "GetSectionsWithPagePaths.html" $pagePath -}}
9 {{if index $sectionsWithPagePaths "sections" }}
10 {{- $allSections = $allSections | append (index $sectionsWithPagePaths "sections") -}}
11 {{- range $section, $pagePaths := $sectionsWithPagePaths -}}
12 {{- if ne $section "sections" -}}
13 {{- $menuPagePaths = merge $menuPagePaths (dict $section (index $sectionsWithPagePaths $section)) -}}
14 {{- end -}}
15 {{- end -}}
16 {{- end -}}
17 {{- else -}}
18 {{- $menuPrefix := printf "%s_" $menuPrefix -}}
19 {{- $allSections = $allSections | append $menuPrefix -}}
20 {{- $pagePaths := index $menuPagePaths $pagePath|default slice -}}
21 {{- $pagePaths = $pagePaths|append $pagePath -}}
22 {{- $menuPagePaths = merge $menuPagePaths (dict $menuPrefix $pagePaths) -}}
23 {{- end -}}
24{{ end }}
25{{- $allSections = ($allSections|uniq|sort) -}}
26
27{{- $orderedSections := slice -}}
28{{- range $key := site.Params.Sandpoints.graphMenuOrder -}}
29 {{- if in $allSections $key -}}
30 {{- $orderedSections = $orderedSections|append $key -}}
31 {{- end -}}
32{{- end -}}
33
34{{- $orderedSections := ($orderedSections|append $allSections)|uniq -}}
35
36{{- range $section := $orderedSections -}}
37 {{- if strings.HasSuffix $section "_" -}}
38 {{- $menuPrefix := strings.TrimSuffix "_" $section -}}
39 {{- range $menuSection, $pagePaths := partial "GetSectionsWithPagePaths.html" (index $menuPagePaths $section) -}}
40 {{- if eq $menuSection "sections" -}}{{- continue -}}{{- end -}}
41 {{- partial "graph-menu.html" (dict "cursiveMenuPrefix" $menuPrefix "menuSection" $menuSection "pagePaths" $pagePaths "class" " verb") -}}
42 {{- end -}}
43 {{- else -}}
44 {{- if and $skipPeople (in (slice "author" "editor") $section) -}}{{- continue -}}{{- end -}}
45 {{- partial "graph-menu.html" (dict "cursiveMenuPrefix" "" "menuSection" $section "pagePaths" (index $menuPagePaths $section) "class" " noun") -}}
46 {{- end -}}
47{{- end -}}