1

Extraire les partiels de calcul du thème 2026

This commit is contained in:
2026-04-04 01:34:49 +02:00
parent 9f381c3e56
commit 5c2235b6bb
6 changed files with 0 additions and 74 deletions

View File

@@ -0,0 +1,31 @@
{{- $page := . -}}
{{- $firstPage := false -}}
{{- with $page.Params.dossier -}}
{{- $dossierID := index . 0 -}}
{{- if $dossierID -}}
{{- $group := where site.RegularPages "Params.dossier" "intersect" (slice $dossierID) -}}
{{- if gt (len $group) 0 -}}
{{- $weighted := slice -}}
{{- range $group -}}
{{- if isset .Params "weight" -}}
{{- $weighted = $weighted | append . -}}
{{- end -}}
{{- end -}}
{{- $candidates := $group -}}
{{- if gt (len $weighted) 0 -}}
{{- $sortedByWeight := sort $weighted "Weight" "asc" -}}
{{- $minWeight := (index $sortedByWeight 0).Weight -}}
{{- $candidates = where $sortedByWeight "Weight" $minWeight -}}
{{- end -}}
{{- $sortedByDate := sort $candidates "Date" "asc" -}}
{{- $firstDate := (index $sortedByDate 0).Date -}}
{{- $sameDate := where $sortedByDate "Date" $firstDate -}}
{{- $firstPage = index (sort $sameDate "RelPermalink" "asc") 0 -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- return $firstPage -}}