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 }}