53 lines
1.6 KiB
HTML
53 lines
1.6 KiB
HTML
{{- $current := . }}
|
|
{{- $currentTitle := .Title }}
|
|
{{- $position := .Scratch.Get "paginationPosition" | default "up" }}
|
|
|
|
{{- with index .Params.dossier 0 }}
|
|
{{- $dossierID := . }}
|
|
{{- $allPages := site.RegularPages }}
|
|
{{- $filtered := where $allPages "Params.dossier" "intersect" (slice $dossierID) }}
|
|
{{- $valid := where $filtered "Weight" "gt" 0 }}
|
|
{{- $sorted := sort $valid "Weight" }}
|
|
|
|
{{- if gt (len $sorted) 1 }}
|
|
{{- $index := -1 }}
|
|
{{- range $i, $p := $sorted }}
|
|
{{- if eq $p.Permalink $current.Permalink }}
|
|
{{- $index = $i }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- $prev := index $sorted (sub $index 1) }}
|
|
{{- $next := index $sorted (add $index 1) }}
|
|
{{- with $dossierID -}}
|
|
<div class="sup-title">{{ . }}</div>
|
|
{{- end -}}
|
|
<nav class="pagination" aria-label="Sommaire du dossier">
|
|
{{- if ge $index 1 }}
|
|
<a class="prev" href="{{ $prev.RelPermalink }}" title="Page précédente">←</a>
|
|
{{- else }}
|
|
<span class="disabled prev">←</span>
|
|
{{- end }}
|
|
|
|
<details class="{{ $position }}">
|
|
<summary>Sommaire</summary>
|
|
<ul class="stat">
|
|
{{- range $i, $p := $sorted }}
|
|
<li>
|
|
{{- if eq $p.Permalink $current.Permalink }}
|
|
<span class="current">{{ $p.Title }}</span>
|
|
{{- else }}
|
|
<a href="{{ $p.RelPermalink }}">{{ $p.Title }}</a>
|
|
{{- end }}
|
|
</li>
|
|
{{- end }}
|
|
</ul>
|
|
</details>
|
|
|
|
{{- if lt (add $index 1) (len $sorted) }}
|
|
<a class="next" href="{{ $next.RelPermalink }}" title="Page suivante">→</a>
|
|
{{- else }}
|
|
<span class="disabled next">→</span>
|
|
{{- end }}
|
|
</nav>
|
|
{{- end }}
|
|
{{- end }} |