Website-Redesign/layouts/partials/related_articles.html

22 lines
786 B
HTML
Raw Normal View History

2021-04-15 00:46:53 -05:00
{{ if and (.Site.Params.enableRelatedArticles | default false) .Params.tags }}
{{ $postsList :=
where (
2021-04-15 03:07:42 -05:00
where (
where site.RegularPages "Params.tags" "!=" nil
) "Params.tags" "intersect" .Params.tags
) "Permalink" "ne" .Permalink
}}
{{ if site.Params.randomRelated | default false }}
{{ $postsList = shuffle $postsList }}
{{ end }}
2021-04-15 00:46:53 -05:00
<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>
2021-04-15 00:46:53 -05:00
</div>
{{ end }}