From e9b8277ce3c20aa217a3580902697322bc670668 Mon Sep 17 00:00:00 2001 From: svemagie <869694+svemagie@users.noreply.github.com> Date: Tue, 10 Mar 2026 08:04:01 +0100 Subject: [PATCH] feat: add /til slashpage listing all posts tagged with category "til" - New til.njk generates /til/ with digest-style card listing - Filters collections.posts for category == "til" (string or array) - Shows date, post type, other categories, and content preview - Added /til entry to slashes.njk under Site Pages Co-Authored-By: Claude Sonnet 4.6 --- slashes.njk | 8 ++++++ til.njk | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 til.njk diff --git a/slashes.njk b/slashes.njk index 387ce52..207b081 100644 --- a/slashes.njk +++ b/slashes.njk @@ -157,6 +157,14 @@ eleventyImport:

All posts chronologically

+
  • +
    +

    + /til +

    +
    +

    Today I Learned — small things learnt day to day

    +
  • diff --git a/til.njk b/til.njk new file mode 100644 index 0000000..a34e8f4 --- /dev/null +++ b/til.njk @@ -0,0 +1,77 @@ +--- +layout: layouts/base.njk +title: Today I Learned +withSidebar: true +permalink: /til/ +eleventyImport: + collections: + - posts +--- +{%- set tilPosts = [] -%} +{%- for post in collections.posts -%} + {%- if post.data.category -%} + {%- if post.data.category is string -%} + {%- if post.data.category == "til" -%} + {%- set tilPosts = (tilPosts.push(post), tilPosts) -%} + {%- endif -%} + {%- else -%} + {%- if "til" in post.data.category -%} + {%- set tilPosts = (tilPosts.push(post), tilPosts) -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} +{%- endfor -%} + +
    +

    Today I Learned

    +

    + A collection of concise write-ups on small things I’ve learnt day to day. + ({{ tilPosts.length }} post{% if tilPosts.length != 1 %}s{% endif %}) +

    + + {% if tilPosts.length > 0 %} + + {% else %} +
    +

    + No TIL posts yet. Tag any post with category: til and it will appear here. +

    +
    + {% endif %} +