omegamma/layouts/partials/header.html

89 lines
3.8 KiB
HTML

<!--
Omegamma - Hugo theme for ad5001.eu and related websites
Copyright (C) 2021-2022 Ad5001 <mail@ad5001.eu>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
{{ $white := .Params.HeaderTextWhite }}
<nav class="{{ if $white }}text-white{{ end }}">
<div class="center nav-flex">
{{ $currentPage := . }}
<div class="nav-mobile">
{{ if eq .Site.Language.Lang "en" }}
<a class="navbar-brand" href="{{ .Site.Params.brandWebsite }}" role="button">
{{ else }}
<a class="navbar-brand" href="{{ .Site.Params.brandWebsite }}{{ .Site.Language.Lang }}/" role="button">
{{ end }}
<img src="/img/logo.svg" loading=lazy class="icon-brand" alt="Ad5001's icon"/>
Ad5001
</a>
<button id="navbar-toggler" aria-label="Show menu" class="{{ if $white }}text-white{{ end }}">
<i class="icon-menu icon-larger2-text" alt="Menu icon"></i>
</button>
</div>
<div class="navbar-menu">
<ul class="navbar-list">
{{ range .Site.Menus.main.ByWeight }}
{{ if .HasChildren }}
<li class="menu-with-sub">
<li class="{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}">
<a href="#" role="button">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
<ul class="sub-menu">
{{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }} background">
<a href="{{ .URL }}" role="button" rel="noreferrer">
{{ .Name }}
</a>
</li>
{{ end }}
</ul>
</li>
{{ else }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL }}" role="button" rel="noreferrer">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
{{ end }}
{{ end }}
{{ $currentLang := .Site.Language }}
{{ if .IsTranslated }}
<li class="menu-with-sub">
<a href="#" role="button">
<i class="icon-lang icon-as-text" alt="{{ i18n "language" }} language flag"></i>
<span class="mobile-label">{{ i18n "language" }}</span>
</a>
<ul class="sub-menu center">
{{ range .Translations }}
<li class="background">
<a href="{{ .Permalink }}" role="button">
{{ index site.Data.flags .Language.Lang }} {{ .Language.LanguageName }}
</a>
</li>
{{ end }}
</ul>
</li>
{{ end }}
</ul>
</div>
</div>
</nav>