feat: Ajout des articles mise en avant
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details

This commit is contained in:
Simon 2025-03-25 10:56:53 +01:00
parent a7abcd5b4c
commit 4ce0a04f96
2 changed files with 17 additions and 7 deletions

View File

@ -9,9 +9,14 @@
<div class="news viemunicipale">
<h1>Le fil des <strong>actualités</strong></h1>
{{ $lastnews := first 4 (where $actualites "Params.event" false) }}
{{ $first := index (first 1 $lastnews) 0 }}
{{ $others := after 1 $lastnews }}
{{ with $first }}
{{ $highlight := first 1 (where $lastnews "Params.highlight" true) }}
{{ if gt (len $highlight) 0 }}
{{ $highlight = index $highlight 0 }}
{{ else }}
{{ $highlight = index $lastnews 0 }}
{{ end }}
{{ $others := where $lastnews "Title" "ne" $highlight.Title }}
{{ with $highlight }}
{{ .Scratch.Set "big" true }}
{{ partial "article-preview.html" . }}
{{ end }}
@ -25,9 +30,14 @@
<div class="news associations">
<h2 class="h1">Le fil des <strong>Évènements</strong></h2>
{{ $lastnews := first 4 (where $actualites "Params.event" true) }}
{{ $first := index (first 1 $lastnews) 0 }}
{{ $others := after 1 $lastnews }}
{{ with $first }}
{{ $highlight := first 1 (where $lastnews "Params.highlight" true) }}
{{ if gt (len $highlight) 0 }}
{{ $highlight = index $highlight 0 }}
{{ else }}
{{ $highlight = index $lastnews 0 }}
{{ end }}
{{ $others := where $lastnews "Title" "ne" $highlight.Title }}
{{ with $highlight }}
{{ .Scratch.Set "big" true }}
{{ partial "article-preview.html" . }}
{{ end }}

View File

@ -43,7 +43,7 @@ const config = {
},
actualites: {
readByQueryOption: {
fields: ['title', 'date', 'image', 'image_credit', 'vignette', 'vignette_credit', 'description', 'auteur', 'draft', 'content', 'event', 'authors.Association_id.denomination'],
fields: ['title', 'date', 'highlight', 'image', 'image_credit', 'vignette', 'vignette_credit', 'description', 'auteur', 'draft', 'content', 'event', 'authors.Association_id.denomination'],
filter: filterDraft,
limit: 1000
},