Introduction du nouveau thème
This commit is contained in:
53
themes/42/layouts/_partials/dossier-summary.html
Normal file
53
themes/42/layouts/_partials/dossier-summary.html
Normal file
@@ -0,0 +1,53 @@
|
||||
{{- $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 }}
|
||||
Reference in New Issue
Block a user