From e768c48c05bfb8b65ad0de92920fd230895073f8 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Tue, 12 Sep 2023 17:02:42 -0500 Subject: [PATCH] add related posts to sidebar --- config/_default/params.toml | 1 + layouts/partials/aside.html | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/config/_default/params.toml b/config/_default/params.toml index 1bf3b67..372e595 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -4,6 +4,7 @@ description = "while (true) { bugs++; }" mainSections = ["posts"] fallBackOgImage = "images/broken-computer.svg" numberOfFeaturedPosts = 5 +numberOfRelatedPosts = 5 author = "codesplice" indexTitle = ".-. ..- -. - .. -- . - . .-. .-. --- .-." diff --git a/layouts/partials/aside.html b/layouts/partials/aside.html index 8a08520..61a306a 100644 --- a/layouts/partials/aside.html +++ b/layouts/partials/aside.html @@ -22,6 +22,25 @@
{{ end }} +{{ if isset .Params "series" }} +{{$related := where .Site.RegularPages ".Params.series" "eq" .Params.series }} +{{- $relatedLimit := default 8 .Site.Params.numberOfRelatedPosts }} +

More {{ .Params.series }}

+ +
+{{ end }} + {{- $posts := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} {{- $featured := default 8 .Site.Params.numberOfFeaturedPosts }} {{- $featuredPosts := first $featured (where $posts "Params.featured" true)}}