added option to shuffle related articles at build

This commit is contained in:
Gabriele Musco 2021-04-15 10:14:05 +02:00
parent e7257ec518
commit 9f75eb3378
No known key found for this signature in database
GPG Key ID: 8539FD3454380B83
2 changed files with 4 additions and 0 deletions

View File

@ -88,6 +88,7 @@ summaryLength = 70 # number of words for article summaries
# the bottom of the article, after the comments
enableRelatedArticles = false
relatedArticlesNum = 2 # how many related articles to show
randomRelated = false # sorts related articles in random order (randomized at built time)
[menu]
# these links will be added to the main navigation menu, sorted by weight

View File

@ -6,6 +6,9 @@
) "Params.tags" "intersect" .Params.tags
) "Permalink" "ne" .Permalink
}}
{{ if site.Params.randomRelated | default false }}
{{ $postsList = shuffle $postsList }}
{{ end }}
<div class="relatedArticlesContainer">
<hr />
<h2>More posts like this</h2>