Add Latest/Featured Articles on main page

This commit is contained in:
kanungle
2026-06-23 09:59:42 -07:00
parent d4a001c903
commit 16efcd9124
62 changed files with 103 additions and 56 deletions
@@ -16,6 +16,46 @@
{{ if .Params.isMainPage }}
<div class="docs-articles docs-articles__blocks">
{{/* Latest section: the 3 most recent (non-hidden, categorized) articles */}}
{{ $latest := first 0 site.Pages }}
{{ range $subject.Pages }}
{{ if and (not .Params.isCategoryPage) (not .Params.hideFromList) .Params.category }}
{{ $latest = $latest | append . }}
{{ end }}
{{ end }}
{{ $latest = $latest.ByPublishDate.Reverse }}
{{ if gt (len $latest) 0 }}
<div class="docs-articles__block">
<div class="docs-articles__block-header">
<div>
<h4 class="docs-articles__title">Latest Articles</h4>
<p class="docs-articles__description">The most recent publications from the Qdrant team.</p>
</div>
</div>
<div class="docs-articles__posts">
<div class="row gy-4">
{{ range first 3 $latest }}
<article class="col-12 col-lg-4 post post-sm">
<a class="post-link" href="{{ .RelPermalink }}">
<div class="post-preview">
<img src="{{ .Params.preview_dir }}/preview.jpg" alt="Preview" />
</div>
<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>
</div>
</div>
{{ end }}
{{ range $subject.Pages }}
{{ if .Params.isCategoryPage }}
<div class="docs-articles__block">
@@ -37,7 +77,7 @@
{{ $list := first 0 site.Pages }}
{{ range $subject.Pages }}
{{ if and (eq .Params.category $category) (not .Params.isCategoryPage) }}
{{ if and (eq .Params.category $category) (not .Params.isCategoryPage) (not .Params.hideFromList) }}
{{ $list = $list | append . }}
{{ end }}
{{ end }}
@@ -79,7 +119,7 @@
<div class="row gx-4 gy-5">
{{ $list := first 0 site.Pages }}
{{ range $subject.Pages }}
{{ if and (eq .Params.category $category) (not .Params.isCategoryPage) }}
{{ if and (eq .Params.category $category) (not .Params.isCategoryPage) (not .Params.hideFromList) }}
{{ $list = $list | append . }}
{{ end }}
{{ end }}