From 9f75eb337837acce4a7c0a80a6004eb8d79ad6da Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Thu, 15 Apr 2021 10:14:05 +0200 Subject: [PATCH] added option to shuffle related articles at build --- README.md | 1 + layouts/partials/related_articles.html | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 33aface..f971390 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/layouts/partials/related_articles.html b/layouts/partials/related_articles.html index 583db48..71515be 100644 --- a/layouts/partials/related_articles.html +++ b/layouts/partials/related_articles.html @@ -6,6 +6,9 @@ ) "Params.tags" "intersect" .Params.tags ) "Permalink" "ne" .Permalink }} + {{ if site.Params.randomRelated | default false }} + {{ $postsList = shuffle $postsList }} + {{ end }}

More posts like this