website/layouts/partials/related_articles.html

17 lines
605 B
HTML

{{ if and (.Site.Params.enableRelatedArticles | default false) .Params.tags }}
{{ $postsList :=
where (
where site.RegularPages "Params.tags" "!=" nil
) "Params.tags" "intersect" .Params.tags
}}
<div class="relatedArticlesContainer">
<hr />
<h2>More posts like this</h2>
<div class="postlist {{ if .Site.Params.gridView }}gridView{{ end }}">
{{ range first (.Site.Params.relatedArticlesNum | default 2) $postsList }}
{{- partial "article_card.html" . -}}
{{ end }}
</div>
</div>
{{ end }}