31 lines
1.1 KiB
HTML
31 lines
1.1 KiB
HTML
{{- $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 -}}
|