mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Patrick Kollitsch
10 hours ago c70b22c0c65d21fc25eda46a8182eb042da11da0
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
39
40
{{- /*
  Renders the child entries of a main menu entry. The top level gets the
  `ananke-submenu` class and an id for its toggle button; deeper levels render
  as nested lists without their own toggle.
 
  @param page     page    The current page.
  @param entries  menu    The child entries.
  @param classes  map     Classes from func/header/GetNavigationClasses.html.
  @param id       string  Optional. Id of the top-level list.
  @param overview menu.Entry Optional. Parent entry to link first in click mode.
*/ -}}
{{- $page := .page }}
{{- $classes := .classes }}
<ul {{ with .id }}id="{{ . }}" class="ananke-submenu {{ $classes.submenu }}"{{ else }}class="ananke-submenu-nested list ma0 pa0"{{ end }}>
  {{- with .overview }}
  {{- if .URL }}
  {{- $label := lang.Translate "menuOverview" . | compare.Default .Name }}
  {{- with .Page }}
    {{- with .Params.linktitle }}{{- $label = . }}{{- end }}
  {{- end }}
  {{- $current := partials.Include "func/header/GetMenuCurrent.html" (dict "page" $page "entry" .) }}
  <li class="ananke-submenu-item ananke-submenu-overview">
    <a class="ananke-submenu-link {{ $classes.submenu_link }}" href="{{ .URL }}"{{ if eq $current "page" }} aria-current="page"{{ end }}>{{ $label }}</a>
  </li>
  {{- end }}
  {{- end }}
  {{- range .entries }}
  {{- $current := partials.Include "func/header/GetMenuCurrent.html" (dict "page" $page "entry" .) }}
  <li class="ananke-submenu-item">
    {{- if .URL }}
    <a class="ananke-submenu-link {{ $classes.submenu_link }}" href="{{ .URL }}" title="{{ lang.Translate "pageTitle" . }}"{{ with $current }} aria-current="{{ . }}"{{ end }}>{{ .Name }}</a>
    {{- else }}
    <span class="ananke-submenu-link {{ $classes.submenu_link }}">{{ .Name }}</span>
    {{- end }}
    {{- with .Children }}
    {{ partials.Include "header/submenu.html" (dict "page" $page "entries" . "classes" $classes) }}
    {{- end }}
  </li>
  {{- end }}
</ul>