<nav id="topnav">
  <div class="container">
    <a class="navbar-brand" href="/{{ cond (eq (.Site.Language.Lang) "it") "" .Site.Language.Lang}}">
      <img class="img-fluid" src="/img/logo.svg" alt="SpeedTech">
    </a>

    <div id="topmenu">
      <button id="responsive-button" onclick="htmx.toggleClass(htmx.find('#topmenu'), 'responsive')"><i class="icon icon-menu"></i></button>
      <ul>
        {{ $current := . }}
        {{ range .Site.Menus.main }}
        {{ $topLevel := replace .URL "/" "" }}
          {{ if .HasChildren }}
          <li class="dropdown">
            <a href="{{ .URL }}" role="button">
              {{ .Name }}
            </a>
            <ul class="submenu">
              {{ range .Children }}
                  <li>
                  <a href="{{ .URL }}" title="{{ .Params.title }}">
                    {{with .Params.iconclass}}
                    <i class="{{ . }}"></i>
                    {{end}}
                    {{ .Name }}
                  </a>
                  </li>
              {{ end }}
            </ul>
          </li>
          {{ else }}
          <li class="{{ 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  href="{{ .URL }}">{{ .Name }}</a>
          </li>
          {{ end  }}
          {{ end }}
          {{ if .IsTranslated }}
          {{ range .Translations }}
          <li>
              <a href="{{ .Permalink }}" >{{ upper .Lang }} {{ if .IsPage }} {{ end }} </a>
          </li>
          {{ end}}
          {{ end }}
      </ul>
    </div>

  </div>
</nav>

<!-- *** NAVBAR END ***-->
