<nav class="navbar navbar-expand-md {{ if .IsHome }}navbar-dark{{ else }}navbar-light{{ end }}">
  <div class="container">
    <a class="navbar-brand px-2" href="{{ site.BaseURL | relLangURL }}">
      {{ $logo:= site.Params.logo }}
      {{ $logoWhite:= site.Params.logo_white }}
      {{ if (or $logo $logoWhite) }}
      {{ if .IsHome }}
      <img class="img-fluid" src="{{if $logoWhite }}{{ $logoWhite | absURL }} {{ else }} {{ $logo | absURL }}{{ end }}"
        alt="{{ site.Title }}">
      {{ else }}
      <img class="img-fluid" src="{{ $logo | absURL }}" alt="{{ site.Title }}">
      {{ end }}
      {{ else }}
      {{ site.Title }}
      {{ end }}
    </a>
    <button class="navbar-toggler border-0" type="button" data-toggle="collapse" data-target="#navigation"
      aria-controls="navigation" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse text-center" id="navigation">
      <ul class="navbar-nav ml-auto">
        {{ range site.Menus.main }}
        {{ if .HasChildren }}
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle text-dark" href="#" role="button" data-toggle="dropdown"
            aria-haspopup="true" aria-expanded="false">
            {{ .Name }}
          </a>
          <div class="dropdown-menu">
            {{ range .Children }}
            <a class="dropdown-item" href="{{ .URL | absLangURL }}">{{ .Name }}</a>
            {{ end }}
          </div>
        </li>
        {{ else }}
        <li class="nav-item">
          <a class="nav-link text-dark" href="{{ .URL | absLangURL }}">{{ .Name }}</a>
        </li>
        {{ end }}
        {{ end }}
      </ul>
      <!-- Language List -->
      {{- if site.IsMultiLingual }}
      <select class="lang-list {{ if not .IsHome }}dark{{ end }}" id="select-language"
        onchange="location = this.value;">
        {{ $siteLanguages := site.Languages}}
        {{ $pageLang := .Page.Lang}}
        {{ range .Page.AllTranslations }}
        {{ $translation := .}}
        {{ range $siteLanguages }}
        {{ if eq $translation.Lang .Lang }}
        {{ $selected := false }}
        {{ if eq $pageLang .Lang}}
        <option id="{{ $translation.Language }}" value="{{ $translation.Permalink }}" selected>{{ .LanguageName }}
        </option>
        {{ else }}
        <option id="{{ $translation.Language }}" value="{{ $translation.Permalink }}">{{ .LanguageName }}</option>
        {{ end }}
        {{ end }}
        {{ end }}
        {{ end }}
      </select>
      {{ end }}
    </div>
  </div>
</nav>
