hugo-theme-zzo/layouts/partials/navbar/site-nav.html

53 lines
2.5 KiB
HTML
Raw Normal View History

<nav class="navbar" role="navigation" aria-label="main navigation" data-dir="{{ $.Param "languagedir" | default "ltr" }}">
2019-11-04 13:09:44 +00:00
<div class="navbar__brand">
{{ if $.Param "logo" | default true }}
<a href="{{ "/" | relLangURL }}" title="{{ i18n "tooltip-home" }}" rel="home" class="{{ if eq ($.Param "logoType") "long" }}navbar__long-link{{ else }}navbar__logo-link{{ end }}">
<img src="{{ "/logo.png" | relURL }}" alt="Home" class="navbar__logo">
2019-11-04 13:09:44 +00:00
</a>
{{ else }}
&nbsp;&nbsp;
2019-11-04 13:09:44 +00:00
{{ end }}
{{ if ne .Site.Params.logoType "long" }}
<a href="{{ "/" | relLangURL }}" title="{{ i18n "tooltip-home" }}" rel="home" class="navbar__title-link">
<h6 class="navbar__title">{{ .Site.Params.logoText }}</h6>
</a>
{{ end }}
2019-11-04 13:09:44 +00:00
</div>
{{ partial "navbar/select-theme-mobile" . }}
{{ partial "search/site-search-mobile" . }}
2019-11-04 13:09:44 +00:00
<a role="button" class="navbar__burger" aria-label="menu" aria-expanded="false">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
<div class="navbar__menu">
{{ partial "navbar/select-theme" . }}
{{ $current := . }}
{{ range .Site.Menus.main }}
{{ $active := or ($current.IsMenuCurrent "main" .) ($current.HasMenuCurrent "main" .) }}
{{ $active = or $active (eq .Name $current.Title) }}
{{ $active = or $active (eq (lower .URL) (lower $current.Title)) }}
{{ $active = or $active (eq (lower .URL) (lower $current.Type)) }}
{{ if .HasChildren }}
<div class="navbar__dropdown navbar__slide-down">
<a href="{{ .URL | relLangURL }}" class="navbar__menu-item {{ if $active }}active{{ end }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">
{{ safeHTML .Name }}
<span class="navbar__menu-icon">
{{ partial "svgs/arrow/keyboard-arrow-down.svg" (dict "width" 18 "height" 18) }}
</span>
</a>
<div class="navbar__dropdown--content">
{{ range .Children }}
<a href="{{ .URL | relLangURL }}" class="navbar__dropdown--item" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">{{ safeHTML .Name }}</a>
{{ end }}
</div>
</div>
{{ else }}
<a href="{{ .URL | relLangURL }}" class="navbar__menu-item navbar__slide-down {{ if $active }}active{{ end }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">{{ safeHTML .Name }}</a>
{{ end }}
2019-11-04 13:09:44 +00:00
{{ end }}
</div>
</nav>