do not hide old featured blog posts

This commit is contained in:
generall
2025-05-16 21:45:54 +02:00
parent 348a13e914
commit 3fe13b770f
@@ -2,7 +2,21 @@
<div class="container">
<div class="qdrant-blog-posts__articles row gx-5">
{{ $all := ($.Site.GetPage "blog" .Section).Pages.ByPublishDate.Reverse }}
{{ $paginator := .Paginate (where $all ".Params.featured" "!=" true) 9 }}
<!-- Remove first 4 featured posts from $all -->
{{ $featured := where $all ".Params.featured" true }}
{{ $notFeatured := where $all ".Params.featured" false }}
<!-- All but first 4 featured posts -->
{{ $oldFeatured := after 4 $featured }}
<!-- Concatenate old featured post with all non-featured -->
{{ $allBut4Featured := $oldFeatured | append $notFeatured }}
<!-- Sort by publish date again -->
{{ $allBut4Featured := $allBut4Featured.ByPublishDate.Reverse }}
{{ $paginator := .Paginate $allBut4Featured 9 }}
{{ range $paginator.Pages }}
{{ .Scratch.Set "scope" "list" }}
@@ -11,24 +25,22 @@
{{ $link = .Params.external_link }}
{{ end }}
{{ if or (not .Params.featured) }}
<article class="qdrant-blog-posts__article post col-12 col-lg-4">
<a class="post-link" href="{{ .RelPermalink }}">
{{ if .Params.preview_image }}
<div class="post-preview">
{{ partial "preview-image" (dict "context" . "default_file_name" "preview.jpg" "preview_file" .Params.small_preview_image) }}
</div>
{{ end }}
<h6 class="post-title">{{ .Params.title }}</h6>
<p class="post-description">{{ .Params.description }}</p>
<div class="post-about">
<p>{{ .Params.author }}</p>
<p>{{ time.Format "January 02, 2006" .Date }}</p>
<article class="qdrant-blog-posts__article post col-12 col-lg-4">
<a class="post-link" href="{{ .RelPermalink }}">
{{ if .Params.preview_image }}
<div class="post-preview">
{{ partial "preview-image" (dict "context" . "default_file_name" "preview.jpg" "preview_file" .Params.small_preview_image) }}
</div>
</a>
</article>
{{ end }}
{{ end }}
<h6 class="post-title">{{ .Params.title }}</h6>
<p class="post-description">{{ .Params.description }}</p>
<div class="post-about">
<p>{{ .Params.author }}</p>
<p>{{ time.Format "January 02, 2006" .Date }}</p>
</div>
</a>
</article>
{{ end }}
</div>