hide related section if no related articles
This commit is contained in:
parent
9f75eb3378
commit
4fa759d2c8
|
@ -6,16 +6,18 @@
|
||||||
) "Params.tags" "intersect" .Params.tags
|
) "Params.tags" "intersect" .Params.tags
|
||||||
) "Permalink" "ne" .Permalink
|
) "Permalink" "ne" .Permalink
|
||||||
}}
|
}}
|
||||||
{{ if site.Params.randomRelated | default false }}
|
{{ if $postsList }}
|
||||||
{{ $postsList = shuffle $postsList }}
|
{{ if site.Params.randomRelated | default false }}
|
||||||
{{ end }}
|
{{ $postsList = shuffle $postsList }}
|
||||||
<div class="relatedArticlesContainer">
|
{{ end }}
|
||||||
<hr />
|
<div class="relatedArticlesContainer">
|
||||||
<h2>More posts like this</h2>
|
<hr />
|
||||||
<div class="postlist {{ if .Site.Params.gridView }}gridView{{ end }}">
|
<h2>More posts like this</h2>
|
||||||
{{ range first (.Site.Params.relatedArticlesNum | default 2) $postsList }}
|
<div class="postlist {{ if .Site.Params.gridView }}gridView{{ end }}">
|
||||||
{{- partial "article_card.html" . -}}
|
{{ range first (.Site.Params.relatedArticlesNum | default 2) $postsList }}
|
||||||
{{ end }}
|
{{- partial "article_card.html" . -}}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in New Issue