diff --git a/_includes/components/sections/recent-posts.njk b/_includes/components/sections/recent-posts.njk
index 6997c06..afb4b25 100644
--- a/_includes/components/sections/recent-posts.njk
+++ b/_includes/components/sections/recent-posts.njk
@@ -61,12 +61,12 @@
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
@@ -101,12 +101,12 @@
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
@@ -146,12 +146,12 @@
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
@@ -186,12 +186,12 @@
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
@@ -227,12 +227,12 @@
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
@@ -272,12 +272,12 @@
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
@@ -303,12 +303,12 @@
{{ post.date | dateDisplay }}
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
diff --git a/_includes/layouts/post.njk b/_includes/layouts/post.njk
index 34439f6..2864de1 100644
--- a/_includes/layouts/post.njk
+++ b/_includes/layouts/post.njk
@@ -31,13 +31,13 @@ withBlogSidebar: true
- {% if category %}
+ {% if category | withoutGardenTags %}
{# Handle both string and array categories #}
{% if category is string %}
- {{ category }}
{% else %}
- {% for cat in category %}
+ {% for cat in (category | withoutGardenTags) %}
- {{ cat }}
{% endfor %}
{% endif %}
@@ -233,11 +233,11 @@ withBlogSidebar: true
{% if gardenStage %}
{{ gardenStage }}
{% endif %}
- {% if category %}
+ {% if category | withoutGardenTags %}
{% if category is string %}
{{ category }}
{% else %}
- {% for cat in category %}
+ {% for cat in (category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
diff --git a/articles.njk b/articles.njk
index 300fcbc..27b054f 100644
--- a/articles.njk
+++ b/articles.njk
@@ -37,12 +37,12 @@ permalink: "articles/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNu
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
diff --git a/blog.njk b/blog.njk
index 7b8bb8e..14d21ee 100644
--- a/blog.njk
+++ b/blog.njk
@@ -69,12 +69,12 @@ permalink: "blog/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
@@ -109,12 +109,12 @@ permalink: "blog/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
@@ -154,12 +154,12 @@ permalink: "blog/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
@@ -194,12 +194,12 @@ permalink: "blog/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
@@ -233,12 +233,12 @@ permalink: "blog/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
@@ -278,12 +278,12 @@ permalink: "blog/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
@@ -307,12 +307,12 @@ permalink: "blog/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber
{{ post.date | dateDisplay }}
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
diff --git a/bookmarks.njk b/bookmarks.njk
index d1e6dbb..218cf19 100644
--- a/bookmarks.njk
+++ b/bookmarks.njk
@@ -39,12 +39,12 @@ permalink: "bookmarks/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageN
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
diff --git a/content/content.11tydata.js b/content/content.11tydata.js
index 2b485b5..45d36b5 100644
--- a/content/content.11tydata.js
+++ b/content/content.11tydata.js
@@ -14,9 +14,39 @@ const normalizePermalink = (permalink) => {
return permalink;
};
+/** Valid garden stages — keep in sync with eleventy.config.js gardenStageInfo */
+const GARDEN_STAGES = new Set([
+ "plant", "cultivate", "evergreen", "question", "repot", "revitalize", "revisit",
+]);
+
+const GARDEN_PREFIX = "garden/";
+
+/**
+ * Derive gardenStage from nested tags/categories (e.g. "garden/cultivate")
+ * if the post doesn't already have an explicit gardenStage frontmatter property.
+ * Handles both string and array values for `category` and `tags`.
+ * Works with or without a leading `#`.
+ */
+const deriveGardenStage = (data) => {
+ if (data.gardenStage) return data.gardenStage;
+ const fields = [data.category, data.tags].flat().filter(Boolean);
+ for (const tag of fields) {
+ const clean = String(tag).replace(/^#/, "");
+ if (clean.startsWith(GARDEN_PREFIX)) {
+ const stage = clean.slice(GARDEN_PREFIX.length);
+ if (GARDEN_STAGES.has(stage)) return stage;
+ }
+ }
+ return undefined;
+};
+
export default {
layout: "layouts/post.njk",
eleventyComputed: {
permalink: (data) => normalizePermalink(data.permalink),
+ // Derive gardenStage from nested tags if not set explicitly in frontmatter.
+ // A post with category: [garden/cultivate, dev] gets gardenStage: "cultivate"
+ // automatically, with no other changes needed downstream.
+ gardenStage: (data) => deriveGardenStage(data),
},
};
diff --git a/eleventy.config.js b/eleventy.config.js
index b6526a8..8ee491a 100644
--- a/eleventy.config.js
+++ b/eleventy.config.js
@@ -950,6 +950,18 @@ export default function (eleventyConfig) {
return stages[stage] || null;
});
+ // Strip garden/* tags from a category list so they don't render as
+ // plain category pills alongside the garden badge.
+ eleventyConfig.addFilter("withoutGardenTags", (categories) => {
+ if (!categories) return categories;
+ const arr = Array.isArray(categories) ? categories : [categories];
+ const filtered = arr.filter(
+ (c) => !String(c).replace(/^#/, "").startsWith("garden/"),
+ );
+ if (!Array.isArray(categories)) return filtered[0] ?? null;
+ return filtered;
+ });
+
// Collections for different post types
// Note: content path is content/ due to symlink structure
// "posts" shows ALL content types combined
@@ -1057,6 +1069,8 @@ export default function (eleventyConfig) {
const cats = Array.isArray(item.data.category) ? item.data.category : [item.data.category];
cats.forEach((cat) => {
if (cat && typeof cat === 'string' && cat.trim()) {
+ // Exclude garden/* tags — they're rendered as garden badges, not categories
+ if (cat.replace(/^#/, "").startsWith("garden/")) return;
const slug = slugify(cat.trim());
if (slug && !categoryMap.has(slug)) {
categoryMap.set(slug, cat.trim());
diff --git a/likes.njk b/likes.njk
index ef4e637..f9ef35f 100644
--- a/likes.njk
+++ b/likes.njk
@@ -37,12 +37,12 @@ permalink: "likes/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumbe
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
diff --git a/notes.njk b/notes.njk
index 1a6ed8d..e4da5d2 100644
--- a/notes.njk
+++ b/notes.njk
@@ -32,12 +32,12 @@ permalink: "notes/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumbe
{{ post.date | dateDisplay }}
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
diff --git a/photos.njk b/photos.njk
index 4b0f091..48fd666 100644
--- a/photos.njk
+++ b/photos.njk
@@ -30,12 +30,12 @@ permalink: "photos/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumb
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
diff --git a/replies.njk b/replies.njk
index 140d323..6553335 100644
--- a/replies.njk
+++ b/replies.njk
@@ -42,12 +42,12 @@ permalink: "replies/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNum
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}
diff --git a/reposts.njk b/reposts.njk
index b715e7e..f9e9cb4 100644
--- a/reposts.njk
+++ b/reposts.njk
@@ -42,12 +42,12 @@ permalink: "reposts/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNum
- {% if post.data.category %}
+ {% if post.data.category | withoutGardenTags %}
{% if post.data.category is string %}
{{ post.data.category }}
{% else %}
- {% for cat in post.data.category %}
+ {% for cat in (post.data.category | withoutGardenTags) %}
{{ cat }}
{% endfor %}
{% endif %}