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 %} +