Notes
- {% set sparklineSvg = collections.notes | postingFrequency %}
+ {% set sparklineSvg = collections.listedNotes | postingFrequency %}
{% if sparklineSvg %}
{{ sparklineSvg | safe }}
{% endif %}
{% if paginatedNotes.length > 0 %}
diff --git a/theme/blog.njk b/theme/blog.njk
index c68087d..1e16fc0 100644
--- a/theme/blog.njk
+++ b/theme/blog.njk
@@ -3,7 +3,7 @@ layout: layouts/base.njk
title: Blog
withSidebar: true
pagination:
- data: collections.posts
+ data: collections.listedPosts
size: 20
alias: paginatedPosts
permalink: "blog/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber + 1 }}/{% endif %}"
@@ -11,14 +11,14 @@ permalink: "blog/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber
Blog
- {% set sparklineSvg = collections.posts | postingFrequency %}
+ {% set sparklineSvg = collections.listedPosts | postingFrequency %}
{% if sparklineSvg %}
{{ sparklineSvg | safe }}
{% endif %}
All posts including articles and notes.
- ({{ collections.posts.length }} total)
+ ({{ collections.listedPosts.length }} total)
{% if paginatedPosts.length > 0 %}
diff --git a/theme/eleventy.config.js b/theme/eleventy.config.js
index 3f67d1e..04848ed 100644
--- a/theme/eleventy.config.js
+++ b/theme/eleventy.config.js
@@ -818,20 +818,23 @@ export default function (eleventyConfig) {
};
});
+ // Helper: exclude drafts from collections
+ const isPublished = (item) => !item.data.draft;
+
+ // Helper: exclude unlisted visibility 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";
+ };
+
// Exclude unlisted posts from UI slices like homepage/sidebar recent-post lists.
eleventyConfig.addFilter("excludeUnlistedPosts", (posts) => {
if (!Array.isArray(posts)) return [];
- return posts.filter((post) => {
- const data = post?.data || {};
- const rawVisibility = data.visibility ?? data.properties?.visibility;
- const visibility = Array.isArray(rawVisibility) ? rawVisibility[0] : rawVisibility;
- return String(visibility ?? "").toLowerCase() !== "unlisted";
- });
+ return posts.filter(isListed);
});
- // Helper: exclude drafts from collections
- const isPublished = (item) => !item.data.draft;
-
// Collections for different post types
// Note: content path is content/ due to symlink structure
// "posts" shows ALL content types combined
@@ -842,6 +845,13 @@ export default function (eleventyConfig) {
.sort((a, b) => b.date - a.date);
});
+ eleventyConfig.addCollection("listedPosts", function (collectionApi) {
+ return collectionApi
+ .getFilteredByGlob("content/**/*.md")
+ .filter((item) => isPublished(item) && isListed(item))
+ .sort((a, b) => b.date - a.date);
+ });
+
eleventyConfig.addCollection("notes", function (collectionApi) {
return collectionApi
.getFilteredByGlob("content/notes/**/*.md")
@@ -849,6 +859,13 @@ export default function (eleventyConfig) {
.sort((a, b) => b.date - a.date);
});
+ eleventyConfig.addCollection("listedNotes", function (collectionApi) {
+ return collectionApi
+ .getFilteredByGlob("content/notes/**/*.md")
+ .filter((item) => isPublished(item) && isListed(item))
+ .sort((a, b) => b.date - a.date);
+ });
+
eleventyConfig.addCollection("articles", function (collectionApi) {
return collectionApi
.getFilteredByGlob("content/articles/**/*.md")
diff --git a/theme/notes.njk b/theme/notes.njk
index 646d757..1dc616d 100644
--- a/theme/notes.njk
+++ b/theme/notes.njk
@@ -3,7 +3,7 @@ layout: layouts/base.njk
title: Notes
withSidebar: true
pagination:
- data: collections.notes
+ data: collections.listedNotes
size: 20
alias: paginatedNotes
generatePageOnEmptyData: true
@@ -12,14 +12,14 @@ permalink: "notes/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumbe
Notes
- {% set sparklineSvg = collections.notes | postingFrequency %}
+ {% set sparklineSvg = collections.listedNotes | postingFrequency %}
{% if sparklineSvg %}
{{ sparklineSvg | safe }}
{% endif %}
Short thoughts, updates, and quick posts.
- ({{ collections.notes.length }} total)
+ ({{ collections.listedNotes.length }} total)
{% if paginatedNotes.length > 0 %}