cremeaux/layouts/partials/header.html

46 lines
1.5 KiB
HTML

{{ $imageSize := cond .IsHome "1920x850 Top" "1920x450 Center" }}
<header class="header{{ if .IsHome }} home{{ end }}">
{{ if .Resources.ByType "image" }}
{{ $image := .Resources.GetMatch (default "*" .Params.image) }}
{{ if $image }}
{{ $resized := $image.Fill $imageSize }}
<img class="hero" src="{{ $resized.RelPermalink }}" />
{{ end }}
{{ else }}
{{ $headless := .Site.GetPage "/" }}
{{ $image := $headless.Resources.GetMatch "*" }}
{{ $resized := $image.Fill $imageSize }}
<img class="hero" src="{{ $resized.RelPermalink }}" />
{{ end }}
<nav class="nav">
<div class="container">
<div class="logo">
<a href="/" class="">
<img src="/icons/logo-header.png" 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>