summaryrefslogtreecommitdiff
path: root/themes/terminal/layouts/partials/menu.html
blob: 17d39c8ed92f9756b05f663be73a2010ea09eecb (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<nav class="menu">
  <ul class="menu__inner menu__inner--desktop">
    {{ if or $.Site.Params.showMenuItems ( eq .Site.Params.showMenuItems 0 ) }}
      {{ range first $.Site.Params.showMenuItems $.Site.Menus.main }}
        {{ if not .HasChildren }}
          <li><a href="{{ .URL }}">{{ .Name }}</a></li>
        {{ end }}
      {{ end }}
      {{ if gt (len $.Site.Menus.main) $.Site.Params.showMenuItems }}
        <ul class="menu__sub-inner">
          <li class="menu__sub-inner-more-trigger">{{ $.Site.Params.MenuMore }}</li>

          <ul class="menu__sub-inner-more hidden">
            {{ range last (sub (len $.Site.Menus.main) $.Site.Params.showMenuItems) $.Site.Menus.main }}
              {{ if not .HasChildren }}
                <li><a href="{{ .URL }}">{{ .Name }}</a></li>
              {{ end }}
            {{ end }}
          </ul>
        </ul>
      {{ end }}
    {{ else }}
      {{ range $.Site.Menus.main }}
        {{ if not .HasChildren }}
          <li><a href="{{ .URL }}">{{ .Name }}</a></li>
        {{ end }}
      {{ end }}
    {{ end }}

    {{ if and $.Site.Params.showLanguageSelector (len $.Site.Home.AllTranslations) }}
    <div class="spacer"></div>
    <ul class="language-selector">
      <ul class="language-selector-current">
          <li>{{ .Language.LanguageName }}</li>
      </ul>
      <ul class="language-selector__more hidden">
        {{ range $.Site.Home.AllTranslations }}
        <li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
        {{ end }}
      </ul>
    </ul>
    {{ end }}
  </ul>

  <ul class="menu__inner menu__inner--mobile">
    {{ range $.Site.Menus.main }}
      {{ if not .HasChildren }}
        <li><a href="{{ .URL }}">{{ .Name }}</a></li>
      {{ end }}
    {{ end }}
    {{ if and $.Site.Params.showLanguageSelector (len $.Site.Home.AllTranslations) }}
    <hr />
      {{ range $.Site.Home.AllTranslations }}
        <li>
          <a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
        </li>
      {{ end }}
    {{ end }}
  </ul>
</nav>