{{ $cover := and
(.HasShortcode "blocks/cover")
(not .Site.Params.ui.navbar_translucent_over_cover_disable)
-}}
{{ $baseURL := urls.Parse $.Site.Params.Baseurl -}}

<nav class="td-navbar js-navbar-scroll
            {{- if $cover }} td-navbar-cover {{- end }}" data-bs-theme="dark">
	<div class="container-fluid flex-column flex-lg-row">
		<a class="navbar-brand" href="{{ .Site.Home.RelPermalink }}">
			{{- /**/ -}}
			<span class="navbar-brand__logo navbar-logo">
				{{- if ne .Site.Params.ui.navbar_logo false -}}
				{{ with resources.Get "icons/logo.svg" -}}
				{{ ( . | minify).Content | safeHTML -}}
				{{ end -}}
				{{ end -}}
			</span>
			{{- /**/ -}}
			<span class="navbar-brand__name">
				{{- .Site.Title -}}
			</span>
			{{- /**/ -}}
		</a>
		<div class="td-navbar-nav-scroll ms-md-auto" id="main_navbar">
			<ul class="navbar-nav">
				{{ $p := . -}}
				{{ range .Site.Menus.navbar_main -}}
				{{ if .HasChildren }}
				<li class="nav-item dropdown">
					<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
						aria-expanded="false">
						{{- .Pre -}}<span>{{ .Name }}</span>{{- .Post -}}
					</a>
					<ul class="dropdown-menu">
						{{ range .Children }}
						<li><a class="dropdown-item" href="{{ .URL }}">{{ .Name }}</a></li>
						{{ end }}
					</ul>
				</li>
				{{ else }}
				<li class="nav-item">
					{{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}}
					{{ $href := "" -}}
					{{ with .Page -}}
					{{ $active = or $active ( $.IsDescendant .) -}}
					{{ $href = .RelPermalink -}}
					{{ else -}}
					{{ $href = .URL | relLangURL -}}
					{{ end -}}
					{{ $isExternal := ne $baseURL.Host (urls.Parse .URL).Host -}}
					<a class="nav-link{{if $active }} active{{end }}" href="{{ $href }}" {{if $isExternal }}
						target="_blank" rel="noopener" {{end}}>
						{{- .Pre -}}<span>{{ .Name }}</span>{{- .Post -}}
					</a>
				</li>
				{{ end }}
				{{ end -}}
				{{ if .Site.Params.versions -}}
				<li class="nav-item dropdown d-none d-lg-block">
					{{ partial "navbar-version-selector.html" . -}}
				</li>
				{{ end -}}
				{{ if (gt (len .Site.Home.Translations) 0) -}}
				<li class="nav-item dropdown d-none d-lg-block">
					{{ partial "navbar-lang-selector.html" . -}}
				</li>
				{{ end -}}
				{{ if .Site.Params.ui.showLightDarkModeMenu -}}
				<li class="td-light-dark-menu nav-item dropdown">
					{{ partial "theme-toggler" . }}
				</li>
				{{ end -}}
			</ul>
		</div>

		<div class="d-none d-lg-block">
			{{ partial "search-input.html" . }}
		</div>
	</div>
</nav>
