speedtech-website/layouts/partials/nav.html

55 lines
2.2 KiB
HTML
Raw Permalink Normal View History

2024-10-04 11:58:15 +02:00
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top" id="mainNav">
<div class="container">
<a class="navbar-brand js-scroll-trigger" href="/{{ cond (eq (.Site.Language.Lang) "it") "" .Site.Language.Lang}}">
<img class="img-fluid" src="/img/logo.svg" alt="SpeedTech">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
{{ $current := . }}
{{ range .Site.Menus.main }}
{{ $topLevel := replace .URL "/" "" }}
{{ if .HasChildren }}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ .Name }}
</a>
<ul class="dropdown-menu">
{{ range .Children }}
<li>
<a class="dropdown-item" href="{{ .URL }}" title="{{ .Params.title }}">
{{with .Params.iconclass}}
<i class="{{ . }}"></i>
{{end}}
{{ .Name }}
</a>
</li>
{{ end }}
</ul>
</li>
{{ else }}
<li class="nav-item {{ if eq $current.RelPermalink .URL | or (eq $current.Type $topLevel) | or (and (eq (default (trim .URL "/") .Identifier) "blog") (in (slice "taxonomy" "taxonomyTerm") $current.Kind)) }} active{{ end }}">
<a class="nav-link js-scroll-trigger" href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
{{ end }}
{{ if .IsTranslated }}
{{ range .Translations }}
<li class="nav-item">
<a class="nav-link" href="{{ .Permalink }}" >{{ upper .Lang }} {{ if .IsPage }} {{ end }} </a>
</li>
{{ end}}
{{ end }}
</ul>
</div>
</div>
</nav>
<!-- *** NAVBAR END ***-->