From 09c9a8273b15537b7086a1b91216d48c1873ecad Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Thu, 16 Dec 2021 19:55:03 -0600 Subject: [PATCH] set a limit for how many related series posts should be displayed --- config/_default/params.toml | 1 + layouts/partials/related.html | 6 +++++- layouts/partials/sidebar.html | 8 +++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index aa37bef..807cadb 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -63,6 +63,7 @@ comments = true # Maximum number of recent posts. numberOfRecentPosts = 6 +numberOfRelatedPosts = 6 # Maximum number of featured posts. numberOfFeaturedPosts = 4 diff --git a/layouts/partials/related.html b/layouts/partials/related.html index 6894d58..dc0cacd 100644 --- a/layouts/partials/related.html +++ b/layouts/partials/related.html @@ -1,9 +1,13 @@ {{ if isset .Params "series" }} {{$related := where .Site.RegularPages ".Params.series" "eq" .Params.series }} +{{- $relatedLimit := default 8 .Params.numberOfRelatedPosts }}

{{ T "series_posts" }}{{ .Params.series }}

{{ end }} diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index d6f5033..5e73df6 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -42,13 +42,19 @@ {{- end }} {{ if (and ($relatedInSidebar) (isset .Params "series") ) }} {{$related := where .Site.RegularPages ".Params.series" "eq" .Params.series }} + {{- $relatedLimit := default 8 $s.numberOfRelatedPosts }}

{{ T "series_posts" }}{{ .Params.series }}

{{ end }}