{{ $imageSizeSmall := cond .IsHome "600x600 Top" "600x400 Center" }}
{{ $imageSizeBig := cond .IsHome "1920x850 Top" "1920x450 Center" }}
<header class="header{{ if .IsHome }} home{{ end }}">
  {{ $headless := .Site.GetPage "/" }}
  {{ $image := default ($headless.Resources.GetMatch "*") (.Resources.GetMatch (default "*" .Params.image)) }}
  {{ if $image }}
    {{ $resizedSmall := $image.Fill $imageSizeSmall }}
    {{ $resizedBig := $image.Fill $imageSizeBig }}
    <img
      class="hero no-print"
      src="{{ $resizedSmall.RelPermalink }}"
      srcset="{{ $resizedSmall.RelPermalink }} 600w, {{ $resizedBig.RelPermalink }} 1920w"
      sizes="(max-width: 600px) 500px, 1920px"
     />
  {{ end }}
  <nav class="nav">
    <div class="container">
      <div class="logo">
        <a href="/" class="">
          <img src="/icons/logo-entete-200x70.svg" alt="Blason de Crémeaux" />
        </a>
      </div>
      <button class="open-button">≡ Menu</button>
      <ol id="menu">
        {{ range .Site.Menus.main }}
        <li class="menu{{ if .HasChildren }} withSubmenu{{ end }}">
          <a href="{{ .URL }}">
            <img class="icons" src="/icons/{{ .Identifier }}.svg" alt="{{ .Name }}" /><span>{{ .Name }}</span>
          </a>
          {{ if .HasChildren }}
          <ol class="submenu">
            {{ range .Children }}
              <li>
                <a href="{{ .URL }}">{{ .Name }}</a>
              </li>
            {{ end }}
          </ol>
          {{ end }}
        </li>
        {{ end }}
      </ol>
      <button class="close-button">✖ Fermer</button>
    </div>
  </nav>
</header>
