From ae8bd83a0b1468cc3f98bf987e022121dd8c3b36 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Sun, 1 Feb 2026 11:13:20 +0100 Subject: [PATCH] feat: add support for slash pages (root-level pages) - Add pages collection in eleventy.config.js - Add page.njk layout for slash pages - Add /slashes/ listing page showing all site pages - Pages created via Indiekit go to /{slug}/ instead of /content/pages/ Inspired by https://slashpages.net Co-Authored-By: Claude Opus 4.5 --- _includes/layouts/page.njk | 51 ++++++++++++++++++ eleventy.config.js | 8 +++ slashes.njk | 107 +++++++++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 _includes/layouts/page.njk create mode 100644 slashes.njk diff --git a/_includes/layouts/page.njk b/_includes/layouts/page.njk new file mode 100644 index 0000000..41de18b --- /dev/null +++ b/_includes/layouts/page.njk @@ -0,0 +1,51 @@ +--- +layout: layouts/base.njk +withSidebar: true +--- +{# Layout for slash pages (/about, /now, /uses, etc.) #} +{# These are root-level pages created via Indiekit's page post type #} + +
+
+

+ {{ title }} +

+ {% if summary %} +

+ {{ summary }} +

+ {% endif %} + {% if updated %} +

+ Last updated: +

+ {% endif %} +
+ +
+ {{ content | safe }} +
+ + {# Categories/tags if present #} + {% if category %} + + {% endif %} + + {# Hidden metadata for microformats #} + + +
diff --git a/eleventy.config.js b/eleventy.config.js index a6c5238..7dc717a 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -339,6 +339,14 @@ export default function (eleventyConfig) { .sort((a, b) => b.date - a.date); }); + // Pages collection - root-level slash pages (about, now, uses, etc.) + // These are stored in content/pages/ and output to /{slug}/ + eleventyConfig.addCollection("pages", function (collectionApi) { + return collectionApi + .getFilteredByGlob("content/pages/**/*.md") + .sort((a, b) => (a.data.title || "").localeCompare(b.data.title || "")); + }); + // All content combined for homepage feed eleventyConfig.addCollection("feed", function (collectionApi) { return collectionApi diff --git a/slashes.njk b/slashes.njk new file mode 100644 index 0000000..3a1de7b --- /dev/null +++ b/slashes.njk @@ -0,0 +1,107 @@ +--- +layout: layouts/base.njk +title: Slash Pages +withSidebar: true +permalink: /slashes/ +--- +
+

Slash Pages

+

+ Root-level pages on this site. Inspired by slashpages.net. + ({{ collections.pages.length }} total) +

+ + {# Static pages (hardcoded in theme) #} +
+

Site Pages

+
    +
  • +
    +

    + /about +

    +
    +

    About me and this site

    +
  • +
  • +
    +

    + /listening +

    +
    +

    What I'm listening to

    +
  • +
  • +
    +

    + /funkwhale +

    +
    +

    My Funkwhale activity

    +
  • +
  • +
    +

    + /github +

    +
    +

    My GitHub activity

    +
  • +
  • +
    +

    + /youtube +

    +
    +

    My YouTube channel

    +
  • +
  • +
    +

    + /news +

    +
    +

    RSS feed aggregator

    +
  • +
+
+ + {# Dynamic pages (created via Indiekit) #} + {% if collections.pages.length > 0 %} +
+

Dynamic Pages

+
    + {% for page in collections.pages %} +
  • +
    +

    + + /{{ page.fileSlug }} + +

    +
    + {% if page.data.summary %} +

    {{ page.data.summary }}

    + {% elif page.data.title %} +

    {{ page.data.title }}

    + {% endif %} + {% if page.data.updated %} +

    + Updated: +

    + {% endif %} +
  • + {% endfor %} +
+
+ {% endif %} + + {# Inspiration section #} +
+

Want more slash pages?

+

+ Check out slashpages.net + for inspiration on pages like /now, /uses, /colophon, /blogroll, and more. +

+
+