cremeaux/layouts/partials/header.html

46 lines
1.5 KiB
HTML
Raw Normal View History

{{ $imageSize := cond .IsHome "1920x850 Top" "1920x450 Center" }}
2020-11-09 12:36:28 +01:00
<header class="header{{ if .IsHome }} home{{ end }}">
{{ if .Resources.ByType "image" }}
2020-11-09 12:36:28 +01:00
{{ $image := .Resources.GetMatch (default "*" .Params.image) }}
{{ if $image }}
{{ $resized := $image.Fill $imageSize }}
<img class="hero" src="{{ $resized.RelPermalink }}" />
2020-11-09 12:36:28 +01:00
{{ end }}
{{ else }}
{{ $headless := .Site.GetPage "/" }}
{{ $image := $headless.Resources.GetMatch "*" }}
{{ $resized := $image.Fill $imageSize }}
<img class="hero" src="{{ $resized.RelPermalink }}" />
2020-11-09 12:36:28 +01:00
{{ end }}
2020-11-04 23:45:35 +01:00
<nav class="nav">
2020-11-05 14:14:55 +01:00
<div class="container">
<div class="logo">
2020-10-21 16:23:05 +02:00
<a href="/" class="">
2020-11-09 12:36:28 +01:00
<img src="/icons/logo-header.png" alt="Blason de Crémeaux" />
2020-10-21 16:23:05 +02:00
</a>
2020-11-05 14:14:55 +01:00
</div>
<button class="open-button">≡ Menu</button>
<ol id="menu">
{{ range .Site.Menus.main }}
<li class="menu{{ if .HasChildren }} withSubmenu{{ end }}">
2020-11-05 14:14:55 +01:00
<a href="{{ .URL }}">
2020-11-09 12:36:28 +01:00
<img class="icons" src="/icons/{{ .Identifier }}.svg" alt="{{ .Name }}" />
2020-11-05 14:14:55 +01:00
<span>{{ .Name }}</span>
</a>
{{ if .HasChildren }}
<ol class="submenu">
{{ range .Children }}
<li>
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ol>
{{ end }}
2020-11-05 14:14:55 +01:00
</li>
{{ end }}
</ol>
<button class="close-button">✖ Fermer</button>
</div>
2020-11-04 23:45:35 +01:00
</nav>
</header>