diff --git a/_includes/components/sections/recent-posts.njk b/_includes/components/sections/recent-posts.njk index 36c85cf..56afddb 100644 --- a/_includes/components/sections/recent-posts.njk +++ b/_includes/components/sections/recent-posts.njk @@ -9,9 +9,9 @@ {% set showSummary = sectionConfig.showSummary if sectionConfig.showSummary is defined else true %} {% set primaryPosts = collections.posts if (collections and collections.posts) else [] %} {% set fallbackRecentPosts = collections.recentPosts if (collections and collections.recentPosts) else [] %} -{% set listedPosts = primaryPosts | excludeUnlistedPosts %} +{% set listedPosts = primaryPosts | excludeUnlistedPosts | excludeWhereNotes %} {% if not (listedPosts and listedPosts.length) %} - {% set listedPosts = fallbackRecentPosts | excludeUnlistedPosts %} + {% set listedPosts = fallbackRecentPosts | excludeUnlistedPosts | excludeWhereNotes %} {% endif %} {% if listedPosts and listedPosts.length %} diff --git a/_includes/components/widgets/recent-posts.njk b/_includes/components/widgets/recent-posts.njk index 82e8b0d..0097947 100644 --- a/_includes/components/widgets/recent-posts.njk +++ b/_includes/components/widgets/recent-posts.njk @@ -1,6 +1,6 @@ {# Recent Posts Widget (sidebar) - compact type-aware list #} {% set recentPosts = recentPosts or collections.recentPosts %} -{% set listedRecentPosts = recentPosts | excludeUnlistedPosts %} +{% set listedRecentPosts = recentPosts | excludeUnlistedPosts | excludeWhereNotes %} {% if listedRecentPosts and listedRecentPosts.length %}
diff --git a/eleventy.config.js b/eleventy.config.js index 7e60213..f975fd9 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -913,14 +913,28 @@ export default function (eleventyConfig) { // Helper: exclude drafts from collections const isPublished = (item) => !item.data.draft; - // Helper: exclude unlisted visibility from public listing surfaces + // Helper: exclude unlisted/private/where/Loc notes from public listing surfaces const isListed = (item) => { const data = item?.data || {}; const rawVisibility = data.visibility ?? data.properties?.visibility; const visibility = Array.isArray(rawVisibility) ? rawVisibility[0] : rawVisibility; - return String(visibility ?? "").toLowerCase() !== "unlisted"; + const tags = (data.category || data.tags || []).map(t => typeof t === 'string' ? t.toLowerCase() : ''); + // Exclude unlisted, private, and where/Loc notes + if (["unlisted", "private"].includes(String(visibility ?? "").toLowerCase())) return false; + if (tags.includes("where") || tags.includes("loc")) return false; + return true; }; + // Filter: exclude where/Loc notes from collections + eleventyConfig.addFilter("excludeWhereNotes", (posts) => { + if (!Array.isArray(posts)) return []; + return posts.filter(item => { + const data = item?.data || {}; + const tags = (data.category || data.tags || []).map(t => typeof t === 'string' ? t.toLowerCase() : ''); + return !tags.includes("where") && !tags.includes("loc"); + }); + }); + // Exclude unlisted posts from UI slices like homepage/sidebar recent-post lists. eleventyConfig.addFilter("excludeUnlistedPosts", (posts) => { if (!Array.isArray(posts)) return []; diff --git a/notes.njk b/notes.njk index 6f42842..53e1f8e 100644 --- a/notes.njk +++ b/notes.njk @@ -3,7 +3,7 @@ layout: layouts/base.njk title: Notes withSidebar: true pagination: - data: collections.listedNotes + data: collections.listedNotes | excludeWhereNotes size: 20 alias: paginatedNotes generatePageOnEmptyData: true