cremeaux/layouts/partials/header.html

49 lines
2.0 KiB
HTML
Raw Normal View History

2021-01-19 23:52:52 +01:00
{{ $isBig := (default .IsHome .Params.big) }}
2021-05-03 14:57:56 +02:00
{{ $imageSizeSmall := cond $isBig "600x600 Top webp" "600x400 Center webp" }}
{{ $imageSizeBig := cond $isBig "1920x850 Top webp" "1920x450 Center webp" }}
2021-01-19 23:52:52 +01:00
<header class="header{{ if $isBig }} home{{ end }}">
{{ $headless := .Site.GetPage "/" }}
2021-04-08 17:27:37 +02:00
{{ $image := default ($headless.Resources.GetMatch "**.jpg") (.Resources.GetMatch (default "**.jpg" .Params.image)) }}
{{ if $image }}
{{ $resizedSmall := $image.Fill $imageSizeSmall }}
{{ $resizedBig := $image.Fill $imageSizeBig }}
2020-12-09 17:23:27 +01:00
<img
class="hero no-print"
src="{{ $resizedSmall.RelPermalink }}"
srcset="{{ $resizedSmall.RelPermalink }} 600w, {{ $resizedBig.RelPermalink }} 1920w"
sizes="(max-width: 600px) 500px, 1920px"
2023-02-22 14:23:23 +01:00
alt="{{ or .Params.image_ .Params.image_credit }}"
title="{{ or .Params.image_ .Params.image_credit }}"
2020-12-09 17:23:27 +01:00
/>
2020-11-09 12:36:28 +01:00
{{ end }}
<nav class="nav" id="nav" data-open="false">
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="">
<img src="/icons/logo-entete-200x70.svg" 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" onClick="document.getElementById('nav').setAttribute('data-open', true)">≡ Menu</button>
2020-11-05 14:14:55 +01:00
<ol id="menu">
{{ range .Site.Menus.main }}
2023-06-05 16:16:20 +02:00
<li class="menu{{ if .HasChildren }} withSubmenu{{ end }} {{ .Identifier }}">
2020-11-05 14:14:55 +01:00
<a href="{{ .URL }}">
<img class="icons" src="/icons/{{ .Identifier }}.svg" alt="{{ .Name }}" width="30" height="30" /><span>{{ .Name }}</span>
2020-11-05 14:14:55 +01:00
</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" onClick="document.getElementById('nav').setAttribute('data-open', false)">✖ Fermer</button>
2020-11-05 14:14:55 +01:00
</div>
2020-11-04 23:45:35 +01:00
</nav>
</header>