1
Files
2025/themes/default/layouts/partials/header.html

55 lines
2.2 KiB
HTML

<header>
{{ $logo := resources.GetMatch "logo-large.png" }}
{{ with $logo.Resize "x120" }}
<img src="{{ .RelPermalink }}" alt="Logo" class="site-logo" />
{{ end }}
<div class="header-content">
<h1 class="page-title">{{ .Title }}</h1>
<div class="page-meta">
{{ with .Date }}
<time datetime="{{ . }}">{{ . | time.Format ":date_long" }}</time>
{{ end }}
{{ $section := "" -}}
{{- with .Parent -}}
{{- $sectionPath := path.Base .File.Dir -}}
{{- $section = $sectionPath -}}
{{- end -}}
<span class="section section-{{ $section }}">{{ .Parent.LinkTitle }}</span>
{{- if ge .ReadingTime 5 -}}
{{- .ReadingTime }} min de lecture
{{- end -}}
</div>
</div>
</header>
<div class="tablet-header">
{{ $logo := resources.GetMatch "logo-large.png" }}
{{ with $logo.Resize "x32" }}
<img src="{{ .RelPermalink }}" alt="Logo du site" class="tablet-logo" />
{{ end }}
<span class="tablet-title">{{ .Title }}</span>
<div class="tablet-links" role="navigation" aria-label="Navigation rapide">
<a class="tablet-link" href="/" title="Retour à la page d'accueil du site">
<span class="tablet-link-icon" aria-hidden="true"></span>
<span class="tablet-link-label">Accueil</span>
</a>
{{ if and (.Parent) (ne .Parent.RelPermalink "/") }}
<a class="tablet-link" href="{{ .Parent.RelPermalink }}" title="Retour à la section {{ .Parent.LinkTitle }}">
<span class="tablet-link-icon" aria-hidden="true"></span>
<span class="tablet-link-label">{{ or .Parent.LinkTitle "Section" }}</span>
</a>
{{ end }}
{{ with .TableOfContents }}
{{ if gt (len (plainify .)) 0 }}
<details id="toc" class="tablet-menu" title="Table des matières">
<summary class="tablet-link">
<span class="tablet-link-icon" aria-hidden="true"></span>
<span class="tablet-link-label">Sommaire</span>
</summary>
{{ . | safeHTML }}
</details>
{{ end }}
{{ end }}
</div>
</div>