1
Files
2025/themes/2026/layouts/_partials/article-footer.html
2026-02-21 01:50:39 +01:00

50 lines
1.8 KiB
HTML

{{- $page := . -}}
{{- with $page.Params.dossier -}}
{{- $dossierID := index . 0 -}}
{{- if $dossierID -}}
{{- $group := where site.RegularPages "Params.dossier" "intersect" (slice $dossierID) -}}
{{- $sorted := sort $group "RelPermalink" "asc" -}}
{{- $sorted = sort $sorted "Date" "asc" -}}
{{- $sorted = sort $sorted "Weight" "asc" -}}
{{- if gt (len $sorted) 1 -}}
{{- $scratch := newScratch -}}
{{- $scratch.Set "index" -1 -}}
{{- range $i, $item := $sorted -}}
{{- if eq $item.Permalink $page.Permalink -}}
{{- $scratch.Set "index" $i -}}
{{- end -}}
{{- end -}}
{{- $index := $scratch.Get "index" -}}
{{- if ge $index 0 -}}
{{- $prev := false -}}
{{- $next := false -}}
{{- if gt $index 0 -}}
{{- $prev = index $sorted (sub $index 1) -}}
{{- end -}}
{{- if lt (add $index 1) (len $sorted) -}}
{{- $next = index $sorted (add $index 1) -}}
{{- end -}}
<footer class="article-footer">
<nav class="article-footer-dossier-nav" aria-label="Navigation dans le dossier">
<p class="article-footer-dossier-nav-label"><span>Dossier</span><strong>{{ $dossierID }}</strong></p>
<div class="article-footer-dossier-nav-links">
{{- with $prev -}}
<p class="article-footer-dossier-nav-link article-footer-dossier-nav-link-prev">
<span>Page précédente</span>
<a href="{{ .RelPermalink }}" title="{{ .Title }}">{{ .Title }}</a>
</p>
{{- end -}}
{{- with $next -}}
<p class="article-footer-dossier-nav-link article-footer-dossier-nav-link-next">
<span>Page suivante</span>
<a href="{{ .RelPermalink }}" title="{{ .Title }}">{{ .Title }}</a>
</p>
{{- end -}}
</div>
</nav>
</footer>
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}