vmems-website/themes/vmems-theme/layouts/partials/header.html

30 lines
1.1 KiB
HTML
Raw Permalink Normal View History

<header class=navbar>
<a href="/" class=navbar-logo-container>
{{ if default false .Site.Params.disabled_logo }}
<span>{{ .Site.Params.logo_text }}</span>
{{ else }}
<img src="{{ .Site.Params.logo | relURL }}" alt="{{ .Title }} logo" class="navbar-logo desktop-only-element">
<img src="{{ .Site.Params.logo_small | relURL}}" alt="{{ .Title }} logo" class="navbar-logo mobile-only-element">
{{ end }}
</a>
<input type=checkbox id=navbar-list-toggler hidden>
{{ $current := . }}
<ul class="desktop-only-element navbar-list">
{{ range .Site.Menus.main }}
{{ $active := "" }}
{{ $menu_item_url := .URL | relLangURL }}
{{ $page_url:= $current.RelPermalink | relLangURL }}
{{ if eq $menu_item_url $page_url }}
{{ $active = "active" }}
{{ end }}
{{ if (and (hasPrefix $page_url "/blog/") (eq $menu_item_url "/blog/")) }}
{{ $active = "active" }}
{{ end }}
<li class="navbar-list-item {{ $active }}">{{ if .URL }}<a href="{{ .URL }}">{{ .Name }}</a>{{ else }}{{ .Name }}{{ end }}</li>
{{ end }}
</ul>
<label id=navbar-list-toggler-label for=navbar-list-toggler class="mobile-only-element"><i class="fa-solid fa-bars"></i></label>
</header>