From 39011387382221f3bd36588f4635afba97b23614 Mon Sep 17 00:00:00 2001 From: svemagie <869694+svemagie@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:47:21 +0100 Subject: [PATCH] Fix homepage recent posts rendering --- _includes/components/sections/recent-posts.njk | 15 ++++++++++----- .../components/sections/recent-posts.njk | 15 ++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/_includes/components/sections/recent-posts.njk b/_includes/components/sections/recent-posts.njk index 2a40d2d..36c85cf 100644 --- a/_includes/components/sections/recent-posts.njk +++ b/_includes/components/sections/recent-posts.njk @@ -7,7 +7,12 @@ {% set sectionConfig = section.config or {} %} {% set maxItems = sectionConfig.maxItems or 5 %} {% set showSummary = sectionConfig.showSummary if sectionConfig.showSummary is defined else true %} -{% set listedPosts = collections.posts | excludeUnlistedPosts %} +{% set primaryPosts = collections.posts if (collections and collections.posts) else [] %} +{% set fallbackRecentPosts = collections.recentPosts if (collections and collections.recentPosts) else [] %} +{% set listedPosts = primaryPosts | excludeUnlistedPosts %} +{% if not (listedPosts and listedPosts.length) %} + {% set listedPosts = fallbackRecentPosts | excludeUnlistedPosts %} +{% endif %} {% if listedPosts and listedPosts.length %}
@@ -68,7 +73,7 @@ {% endif %} - {% unfurl likedUrl %} + {{ likedUrl | unfurlCard | safe }} {{ likedUrl }} @@ -112,7 +117,7 @@ {{ post.data.title }} {% endif %} - {% unfurl bookmarkedUrl %} + {{ bookmarkedUrl | unfurlCard | safe }} {{ bookmarkedUrl }} @@ -151,7 +156,7 @@ {% endif %} - {% unfurl repostedUrl %} + {{ repostedUrl | unfurlCard | safe }} {{ repostedUrl }} @@ -190,7 +195,7 @@ {% endif %} - {% unfurl replyToUrl %} + {{ replyToUrl | unfurlCard | safe }} {{ replyToUrl }} diff --git a/theme/_includes/components/sections/recent-posts.njk b/theme/_includes/components/sections/recent-posts.njk index 2a40d2d..36c85cf 100644 --- a/theme/_includes/components/sections/recent-posts.njk +++ b/theme/_includes/components/sections/recent-posts.njk @@ -7,7 +7,12 @@ {% set sectionConfig = section.config or {} %} {% set maxItems = sectionConfig.maxItems or 5 %} {% set showSummary = sectionConfig.showSummary if sectionConfig.showSummary is defined else true %} -{% set listedPosts = collections.posts | excludeUnlistedPosts %} +{% set primaryPosts = collections.posts if (collections and collections.posts) else [] %} +{% set fallbackRecentPosts = collections.recentPosts if (collections and collections.recentPosts) else [] %} +{% set listedPosts = primaryPosts | excludeUnlistedPosts %} +{% if not (listedPosts and listedPosts.length) %} + {% set listedPosts = fallbackRecentPosts | excludeUnlistedPosts %} +{% endif %} {% if listedPosts and listedPosts.length %}
@@ -68,7 +73,7 @@ {% endif %} - {% unfurl likedUrl %} + {{ likedUrl | unfurlCard | safe }} {{ likedUrl }} @@ -112,7 +117,7 @@ {{ post.data.title }} {% endif %} - {% unfurl bookmarkedUrl %} + {{ bookmarkedUrl | unfurlCard | safe }} {{ bookmarkedUrl }} @@ -151,7 +156,7 @@ {% endif %} - {% unfurl repostedUrl %} + {{ repostedUrl | unfurlCard | safe }} {{ repostedUrl }} @@ -190,7 +195,7 @@ {% endif %} - {% unfurl replyToUrl %} + {{ replyToUrl | unfurlCard | safe }} {{ replyToUrl }}