1

Harmoniser les asides et le rendu des articles

Closes #5

Closes #6

Closes #8

Closes #9

Closes #10
This commit is contained in:
2026-04-05 15:07:52 +02:00
parent edc6f3def5
commit 67717fdb7b
17 changed files with 279 additions and 227 deletions

View File

@@ -87,40 +87,38 @@
{{- end -}}
{{- if gt (len $unusedImages) 0 -}}
<aside class="article-complementary-images">
<section>
<h2>Images complémentaires</h2>
<ul>
{{- range $unusedImages -}}
{{- $imageName := path.Base .Name -}}
{{- $imageStem := $imageName | replaceRE "\\.[^.]+$" "" -}}
{{- $data := dict -}}
{{- $dataFile := $page.Resources.Get (printf "data/images/%s.yaml" $imageStem) -}}
{{- if not $dataFile -}}
{{- $dataFile = $page.Resources.Get (printf "data/%s.yaml" $imageStem) -}}
{{- end -}}
{{- if $dataFile -}}
{{- with $dataFile.Content | transform.Unmarshal -}}
{{- $data = . -}}
{{- end -}}
{{- end -}}
{{- $title := default (printf "Image complémentaire : %s" $imageName) (index $data "title") -}}
{{- $thumbnail := . -}}
{{- if and (ne .MediaType.SubType "svg") (gt .Width 360) -}}
{{- $thumbnail = partial "media/process-image.html" (dict
"image" .
"action" "Resize"
"spec" "360x"
) -}}
{{- end -}}
<li>
<a href="{{ .RelPermalink }}" title="{{ $title }}">
<img src="{{ $thumbnail.RelPermalink }}" alt="{{ $title }}" loading="lazy" decoding="async">
</a>
</li>
<section class="article-aside-block article-complementary-files">
<h2>Fichiers complémentaires</h2>
<ul>
{{- range $unusedImages -}}
{{- $imageName := path.Base .Name -}}
{{- $imageStem := $imageName | replaceRE "\\.[^.]+$" "" -}}
{{- $data := dict -}}
{{- $dataFile := $page.Resources.Get (printf "data/images/%s.yaml" $imageStem) -}}
{{- if not $dataFile -}}
{{- $dataFile = $page.Resources.Get (printf "data/%s.yaml" $imageStem) -}}
{{- end -}}
</ul>
</section>
</aside>
{{- if $dataFile -}}
{{- with $dataFile.Content | transform.Unmarshal -}}
{{- $data = . -}}
{{- end -}}
{{- end -}}
{{- $title := default (printf "Image complémentaire : %s" $imageName) (index $data "title") -}}
{{- $thumbnail := . -}}
{{- if and (ne .MediaType.SubType "svg") (gt .Width 360) -}}
{{- $thumbnail = partial "media/process-image.html" (dict
"image" .
"action" "Resize"
"spec" "360x"
) -}}
{{- end -}}
<li>
<a href="{{ .RelPermalink }}" title="{{ $title }}">
<img src="{{ $thumbnail.RelPermalink }}" alt="{{ $title }}" loading="lazy" decoding="async">
</a>
</li>
{{- end -}}
</ul>
</section>
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,13 @@
{{- $dossierTitle := "Dossier" -}}
{{- with .Params.dossier -}}
{{- with index . 0 -}}
{{- $dossierTitle = strings.TrimSpace . -}}
{{- end -}}
{{- end -}}
{{- $summary := strings.TrimSpace (partial "dossier-summary.html" (dict "Page" . "ShowTitle" false)) -}}
{{- if ne $summary "" -}}
<section class="article-aside-block article-dossier-summary">
<h2>{{ $dossierTitle }}</h2>
{{- $summary | safeHTML -}}
</section>
{{- end -}}