mirror of
https://github.com/panr/hugo-theme-terminal.git
synced 2024-12-11 10:15:08 +03:00
10b545bb86
Implemented a language selector submenu that can be turned on or off by a config value. Resolves: panr/hugo-theme-terminal#31
61 lines
2.1 KiB
HTML
61 lines
2.1 KiB
HTML
<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 $.Site.Params.showLanguageSelector }}
|
|
<div class="spacer"></div>
|
|
<div class="language-selector">
|
|
|
|
<div class="language-selector-actual">
|
|
<li class="list-inline-item">{{ .Language.LanguageName }} ▾</li>
|
|
</div>
|
|
<div class="language-selector-more hidden">
|
|
{{ range $.Site.Home.AllTranslations }}
|
|
<li class="list-inline-item"><a class="text-dark" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
|
|
{{ end }}
|
|
</div>
|
|
</div>
|
|
{{ 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 $.Site.Params.showLanguageSelector }}
|
|
<hr />
|
|
{{ range $.Site.Home.AllTranslations }}
|
|
<li class="list-inline-item">
|
|
<a class="text-dark" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
|
|
</li>
|
|
{{ end }}
|
|
{{ end }}
|
|
</ul>
|
|
</nav>
|