summaryrefslogtreecommitdiff
path: root/layouts/partials/menu.html
blob: 47f1d4425980acf5b68c159e649a1c9cb021ec85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{{- $page := .page }}
{{- $menuID := .menuID }}

{{ $list := index site.Menus $menuID }} 
{{ if eq $page.Params.menu_order "name"}}
  {{ $list = (index site.Menus $menuID).ByName }}
{{ end}}
{{- with $list }}
  <nav>
    <ul>
      {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
    </ul>
  </nav>
{{- end }}

{{- define "partials/inline/menu/walk.html" }}
  {{- $page := .page }}
  {{- range .menuEntries }}
    {{- partial "menu/item.html" (dict "page" $page "item" .) }}      

  {{- end }}
{{- end }}

{{- define "partials/inline/menu/inline.html" }}
  {{- $page := .page }}
  {{- range .menuEntries }}
    {{- $pageItem := $page.GetPage .URL}}
    {{- if $pageItem.Params.menu_item_override }}
      <a href="{{ .URL }}">{{ $pageItem.Params.menu_item_override }}</a>
   {{- else}}
     <a href="{{ .URL }}"> {{ .Name }}</a>
   {{- end }}

     {{- partial "menu/new-or-up.html" (dict "page" ($pageItem)) }}
     
  {{- end }}
{{- end }}