From e8ba3b9ae65241f1087cb770da98df6ff421e961 Mon Sep 17 00:00:00 2001 From: svemagie <869694+svemagie@users.noreply.github.com> Date: Sun, 15 Mar 2026 10:56:22 +0100 Subject: [PATCH] feat: nested tags (Obsidian-style) for categories system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds hierarchical tag support using "/" separator (e.g. "tech/programming/js"). - New filters: nestedSlugify, categoryMatches, categoryBreadcrumb, categoryGroupByRoot, categoryDirectChildren - categories collection auto-generates ancestor pages for nested tags - categories.njk: breadcrumb nav, sub-tags section, ancestor-aware post matching - categories-index.njk: grouped tree view (root + indented children) - categories widget: shows root tags only with child count badge - All category links updated from slugify → nestedSlugify (backward-compatible) Co-Authored-By: Claude Sonnet 4.6 --- .../components/sections/recent-posts.njk | 28 +++--- _includes/components/widgets/categories.njk | 9 +- .../components/widgets/post-categories.njk | 4 +- _includes/layouts/base.njk | 4 +- _includes/layouts/page.njk | 4 +- _includes/layouts/post.njk | 4 +- articles.njk | 4 +- blog.njk | 28 +++--- bookmarks.njk | 4 +- categories-index.njk | 32 ++++++- categories.njk | 48 +++++++--- eleventy.config.js | 93 +++++++++++++++++-- likes.njk | 4 +- notes.njk | 4 +- photos.njk | 4 +- replies.njk | 4 +- reposts.njk | 4 +- til.njk | 2 +- 18 files changed, 205 insertions(+), 79 deletions(-) diff --git a/_includes/components/sections/recent-posts.njk b/_includes/components/sections/recent-posts.njk index afb4b25..adea203 100644 --- a/_includes/components/sections/recent-posts.njk +++ b/_includes/components/sections/recent-posts.njk @@ -64,10 +64,10 @@ {% if post.data.category | withoutGardenTags %} {% if post.data.category is string %} - {{ post.data.category }} + {{ post.data.category }} {% else %} {% for cat in (post.data.category | withoutGardenTags) %} - {{ cat }} + {{ cat }} {% endfor %} {% endif %} @@ -104,10 +104,10 @@ {% if post.data.category | withoutGardenTags %} {% if post.data.category is string %} - {{ post.data.category }} + {{ post.data.category }} {% else %} {% for cat in (post.data.category | withoutGardenTags) %} - {{ cat }} + {{ cat }} {% endfor %} {% endif %} @@ -149,10 +149,10 @@ {% if post.data.category | withoutGardenTags %} {% if post.data.category is string %} - {{ post.data.category }} + {{ post.data.category }} {% else %} {% for cat in (post.data.category | withoutGardenTags) %} - {{ cat }} + {{ cat }} {% endfor %} {% endif %} @@ -189,10 +189,10 @@ {% if post.data.category | withoutGardenTags %} {% if post.data.category is string %} - {{ post.data.category }} + {{ post.data.category }} {% else %} {% for cat in (post.data.category | withoutGardenTags) %} - {{ cat }} + {{ cat }} {% endfor %} {% endif %} @@ -230,10 +230,10 @@ {% if post.data.category | withoutGardenTags %} {% if post.data.category is string %} - {{ post.data.category }} + {{ post.data.category }} {% else %} {% for cat in (post.data.category | withoutGardenTags) %} - {{ cat }} + {{ cat }} {% endfor %} {% endif %} @@ -275,10 +275,10 @@ {% if post.data.category | withoutGardenTags %} {% if post.data.category is string %} - {{ post.data.category }} + {{ post.data.category }} {% else %} {% for cat in (post.data.category | withoutGardenTags) %} - {{ cat }} + {{ cat }} {% endfor %} {% endif %} @@ -306,10 +306,10 @@ {% if post.data.category | withoutGardenTags %} {% if post.data.category is string %} - {{ post.data.category }} + {{ post.data.category }} {% else %} {% for cat in (post.data.category | withoutGardenTags) %} - {{ cat }} + {{ cat }} {% endfor %} {% endif %} diff --git a/_includes/components/widgets/categories.njk b/_includes/components/widgets/categories.njk index fa58d91..300d3f0 100644 --- a/_includes/components/widgets/categories.njk +++ b/_includes/components/widgets/categories.njk @@ -1,12 +1,13 @@ -{# Categories/Tags Widget #} +{# Categories/Tags Widget — shows root-level tags; nested children visible on the category page #} {% if categories and categories.length %}

Categories

diff --git a/_includes/components/widgets/post-categories.njk b/_includes/components/widgets/post-categories.njk index 87debc7..e470929 100644 --- a/_includes/components/widgets/post-categories.njk +++ b/_includes/components/widgets/post-categories.njk @@ -5,12 +5,12 @@

Categories

{% if category is string %} - + {{ category }} {% else %} {% for cat in category %} - + {{ cat }} {% endfor %} diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 64135e9..548abfe 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -103,8 +103,8 @@ {% endif %} {% if category and page.url and page.url.startsWith('/categories/') and page.url != '/categories/' %} - - + + {% endif %} diff --git a/_includes/layouts/page.njk b/_includes/layouts/page.njk index cd9228b..63d1249 100644 --- a/_includes/layouts/page.njk +++ b/_includes/layouts/page.njk @@ -88,12 +88,12 @@ withSidebar: true