92 lines
3.1 KiB
HTML
92 lines
3.1 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 -}}
|
|
{{- $coverResourcePath := (urls.Parse $coverPath).Path -}}
|
|
{{- if ne $coverResourcePath "" -}}
|
|
{{- $coverPathLower := lower $coverResourcePath -}}
|
|
{{- if or (strings.HasSuffix $coverPathLower ".yaml") (strings.HasSuffix $coverPathLower ".yml") -}}
|
|
{{- $coverDataFile := $page.Resources.Get $coverResourcePath -}}
|
|
{{- if $coverDataFile -}}
|
|
{{- with $coverDataFile.Content | transform.Unmarshal -}}
|
|
{{- with index . "file" -}}
|
|
{{- $coverFilePath := strings.TrimSpace (printf "%v" .) -}}
|
|
{{- if ne $coverFilePath "" -}}
|
|
{{- $image = $page.Resources.Get $coverFilePath -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- else -}}
|
|
{{- $image = $page.Resources.Get $coverResourcePath -}}
|
|
{{- end -}}
|
|
{{- 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 -}}
|