diff options
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/home.html | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/layouts/home.html b/layouts/home.html index 4eed7ad..0beae1f 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -2,16 +2,28 @@ {{ partial "hero.html" . }} <div class="container feed-section"> - <div class="feed-label">Latest</div> - {{ $posts := where site.RegularPages "Type" "in" (slice "articles") }} {{ $posts := sort $posts "Params.date" "desc" }} - {{ $latest := first 3 $posts }} + + {{ $featured := where $posts "Params.featured" true }} + {{ $notFeatured := where $posts "Params.featured" "!=" true }} <div class="feed-grid"> - {{ range $latest }} - {{ $data := dict "title" .Title "type" .Params.type "description" .Summary "date" .Date "url" .RelPermalink "image" .Params.image "featured" .Params.featured }} - {{ partial "post-card.html" $data }} + {{ if $featured }} + <div class="feed-label">Featured</div> + {{ range first 1 $featured }} + {{ $data := dict "title" .Title "type" .Params.type "description" .Summary "date" .Date "url" .RelPermalink "image" .Params.image "featured" true }} + {{ partial "post-card.html" $data }} + {{ end }} + {{ end }} + + {{ if or $featured $notFeatured }} + {{ if $featured }}<div class="feed-label" style="margin-top: 2rem;">Latest</div>{{ else }}<div class="feed-label">Latest</div>{{ end }} + {{ $latest := first 3 $notFeatured }} + {{ range $latest }} + {{ $data := dict "title" .Title "type" .Params.type "description" .Summary "date" .Date "url" .RelPermalink "image" .Params.image "featured" false }} + {{ partial "post-card.html" $data }} + {{ end }} {{ end }} </div> |
