1
Files
2025/themes/default/layouts/_default/single.html

109 lines
3.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{{ define "main" }}
<main>
<article>
{{ partial "header.html" . -}}
{{- $isLiens := eq .Parent.Title "Liens intéressants" -}}
{{- $mtop := cond $isLiens "0" "2rem" -}}
{{- $coverPath := .Params.cover -}}
{{- $img := false -}}
{{- $coverData := dict -}}
{{- if $coverPath -}}
{{- $img = .Resources.GetMatch $coverPath -}}
{{- if $img }}
{{- $mtop = cond $isLiens "0" "100vh" -}}
{{/* Traitement YAML associé à limage de couverture */}}
{{- $basename := path.Base $coverPath -}}
{{- $filename := replaceRE "\\.[^.]+$" "" $basename -}}
{{- $yamlPath := printf "data/images/%s.yaml" $filename -}}
{{- $yamlFile := .Resources.GetMatch $yamlPath -}}
{{- with $yamlFile }}
{{- $yamlContent := .Content -}}
{{- $coverData = $yamlContent | transform.Unmarshal -}}
{{- end }}
<div class="article-hero {{ if $isLiens }}blurred-cover{{ end }}"
style="background-image: url('{{ $img.RelPermalink }}');">
{{ if $coverData.attribution }}
<div class="image-attribution">
<span>Attribution :</span>
{{ $coverData.attribution | markdownify }}
</div>
{{ end }}
</div>
<div id="article-backdrop"></div>
{{- end }}
{{- end }}
{{- $context := . -}}
{{- $context.Scratch.Set "paginationPosition" "down" -}}
<section class="articles-list">
{{- partial "dossier-summary" . -}}
</section>
<div class="article-content numbered-headings" style="margin-top: {{ $mtop }}">
{{- if $isLiens }}
{{- with .Params.links }}
<div class="external-links-block" style="margin-top: 2rem; text-align: center;">
{{- range . }}
{{- if eq .name "Page d'origine" }}
<a class="external-link" href="{{ .url }}" target="_blank" rel="noopener">
Visiter le site
</a>
{{- else if eq .name "Lien archivé" }}
<a class="archive-link" href="{{ .url }}" target="_blank" rel="noopener">
Voir sur archive.org
</a>
{{- end }}
{{- end }}
</div>
{{- end }}
{{- end }}
{{ .Content }}
</div>
{{ if and $img (gt (len $coverData) 0) }}
<aside class="image-info-block" aria-labelledby="image-info-title">
<h2>Image d'en-tête</h2>
{{ with $coverData.title }}
<h3 id="image-info-title">{{ . | markdownify }}</h3>
{{ end }}
{{ $resized := $img.Resize "800x" }}
<figure class="image-inline">
<a href="{{ $img.RelPermalink }}" title="Cliquez pour agrandir l'image">
<img src="{{ $resized.RelPermalink }}" alt="{{ $coverData.title }}" title="{{ $coverData.title }}" />
</a>
</figure>
{{ with $coverData.description }}
<section class="image-description">
<p>{{ .| markdownify }}</p>
</section>
{{ end }}
{{ with $coverData.prompt }}
<section class="image-prompt">
<h3>Prompt de génération IA</h3>
<blockquote>{{ . }}</blockquote>
</section>
{{ end }}
{{ with $coverData.attribution }}
<footer>
<p><strong>Attribution :</strong> {{ . | markdownify }}</p>
</footer>
{{ end }}
</aside>
{{ end }}
{{- $context.Scratch.Set "paginationPosition" "up" -}}
<section class="articles-list">
{{- partial "dossier-summary" . -}}
</section>
</article>
</main>
{{ end }}