1
Files
2025/themes/2026/layouts/_partials/timeline-list.html

83 lines
2.6 KiB
HTML

{{- $pages := .Pages -}}
{{- if gt (len $pages) 0 -}}
<section class="listing-timeline">
<header>
<h2>Chronologie</h2>
</header>
<ol>
{{- range $pages -}}
{{- $page := . -}}
{{- $coverPath := $page.Params.cover -}}
{{- $image := false -}}
{{- if $coverPath -}}
{{- if strings.HasSuffix $coverPath ".yaml" -}}
{{- $coverAbsPath := printf "%s%s" $page.File.Dir $coverPath -}}
{{- $coverRaw := readFile $coverAbsPath -}}
{{- $coverData := $coverRaw | transform.Unmarshal -}}
{{- with $coverData.file -}}
{{- $image = $page.Resources.GetMatch . -}}
{{- end -}}
{{- else -}}
{{- $image = $page.Resources.GetMatch $coverPath -}}
{{- end -}}
{{- end -}}
{{- $dossierTitle := "" -}}
{{- $dossierFirstPage := false -}}
{{- with $page.Params.dossier -}}
{{- with index . 0 -}}
{{- $dossierTitle = . -}}
{{- $dossierFirstPage = partial "dossier-first-page.html" $page -}}
{{- end -}}
{{- end -}}
<li>
<article>
{{- with $image -}}
<a href="{{ $page.RelPermalink }}">
<figure>
{{- $resized := partial "media/process-image.html" (dict
"image" .
"action" "Fill"
"spec" "600x340"
) -}}
<img src="{{ $resized.RelPermalink }}" alt="Image de couverture pour {{ $page.Title }}" loading="lazy">
</figure>
</a>
{{- end -}}
<div>
<header>
<p>
{{- with $page.Date -}}
<time datetime="{{ . }}">{{ . | time.Format "02/01/2006" }}</time>
{{- end -}}
</p>
{{- with $dossierFirstPage -}}
{{- with $dossierTitle -}}
<p><a href="{{ $dossierFirstPage.RelPermalink }}">{{ $dossierTitle }}</a></p>
{{- end -}}
{{- end -}}
<h3><a href="{{ $page.RelPermalink }}">{{ $page.Title }}</a></h3>
</header>
{{- with $page.Summary -}}
<p>{{ . | plainify | truncate 240 }}</p>
{{- end -}}
<footer>
<p>
{{- with $page.Parent -}}
<a href="{{ .RelPermalink }}">{{ with .LinkTitle }}{{ . }}{{ else }}{{ .Title }}{{ end }}</a>
{{- end -}}
{{- if and $page.Parent (ge $page.ReadingTime 5) -}}<span>·</span>{{- end -}}
{{- if ge $page.ReadingTime 5 -}}
<span>{{ $page.ReadingTime }} min</span>
{{- end -}}
</p>
</footer>
</div>
</article>
</li>
{{- end -}}
</ol>
</section>
{{- end -}}