52 lines
1.5 KiB
HTML
52 lines
1.5 KiB
HTML
{{- $excludePrefix := "interets/liens-interessants/" -}}
|
|
{{- $excludeCurrent := false -}}
|
|
{{- $currentHasDate := false -}}
|
|
{{- with .File -}}
|
|
{{- if strings.HasPrefix .Path $excludePrefix -}}
|
|
{{- $excludeCurrent = true -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- with .Params.date -}}
|
|
{{- $currentHasDate = true -}}
|
|
{{- end -}}
|
|
{{- if not $currentHasDate -}}
|
|
{{- $excludeCurrent = true -}}
|
|
{{- end -}}
|
|
|
|
{{- if not $excludeCurrent -}}
|
|
{{- $related := site.RegularPages.Related . -}}
|
|
{{- $items := slice -}}
|
|
{{- range $related -}}
|
|
{{- $excludeCandidate := false -}}
|
|
{{- $sameDossier := false -}}
|
|
{{- $candidateHasDate := false -}}
|
|
{{- with .File -}}
|
|
{{- if strings.HasPrefix .Path $excludePrefix -}}
|
|
{{- $excludeCandidate = true -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- with .Params.date -}}
|
|
{{- $candidateHasDate = true -}}
|
|
{{- end -}}
|
|
{{- if gt (len (intersect (default (slice) $.Params.dossier) (default (slice) .Params.dossier))) 0 -}}
|
|
{{- $sameDossier = true -}}
|
|
{{- end -}}
|
|
{{- if and $candidateHasDate (not $excludeCandidate) (not $sameDossier) (ne .RelPermalink $.RelPermalink) -}}
|
|
{{- $items = $items | append . -}}
|
|
{{- end -}}
|
|
{{- if ge (len $items) 3 -}}
|
|
{{- break -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- if gt (len $items) 0 -}}
|
|
<section class="article-aside-block article-related">
|
|
<h2>Articles relatifs</h2>
|
|
{{- partial "articles-list.html" (dict
|
|
"Pages" $items
|
|
"ShowDossierBeforeTitle" true
|
|
) -}}
|
|
</section>
|
|
{{- end -}}
|
|
{{- end -}}
|