Nouveau thème pour 2026
This commit is contained in:
30
themes/2026/layouts/_partials/is-dossier-lead.html
Normal file
30
themes/2026/layouts/_partials/is-dossier-lead.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{{- $page := . -}}
|
||||
{{- $isLead := true -}}
|
||||
{{- with $page.Params.dossier -}}
|
||||
{{- $dossierID := index . 0 -}}
|
||||
{{- if $dossierID -}}
|
||||
{{- $group := where site.RegularPages "Params.dossier" "intersect" (slice $dossierID) -}}
|
||||
{{- if gt (len $group) 1 -}}
|
||||
{{- $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 -}}
|
||||
{{- $isLead = eq $firstPage.File.Path $page.File.Path -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $isLead -}}true{{- end -}}
|
||||
Reference in New Issue
Block a user