<nav class="navbar navbar-expand-lg navbar-light bg-light p-3">
  <div class="container-fluid">
    <a class="navbar-brand" href="/">
      <img src="/img/logo/長慶運通 橫式商標(中+英).png" alt="" class="logo">
    </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 me-auto mb-2 mb-lg-0 mt-4 mt-lg-0">
        {{ $currentPage := . }}
        {{ range .Site.Menus.main }}
        {{ if .HasChildren }}

        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown"
            aria-expanded="false">
            {{ .Pre }}
            <span>{{ .Name }}</span>
          </a>
          <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
            {{ range .Children }}
            <li class="{{ if $currentPage.IsMenuCurrent " main" . }}active{{ end }}">
              <a class="dropdown-item" href="{{ .URL }}">{{ .Name }}</a>
            </li>
            {{ end }}
          </ul>
        </li>
        {{ else }}
        <li class="nav-item">
          <a class="nav-link" href="{{ .URL }}">
            {{ .Pre }}
            <span>{{ .Name }}</span>
          </a>
        </li>
        {{ end }}
        {{ end }}
      </ul>
    </div>
  </div>
</nav>