From d9436941fe97a9c3d0df3108395b3f6788ef6fcb Mon Sep 17 00:00:00 2001 From: Jake Holtham Date: Tue, 24 Mar 2026 10:24:04 -0400 Subject: [PATCH] Didnt actually add gitignore last time... oops. Adding it here w/ a new eleventy.js. --- .eleventy.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 2 ++ 2 files changed, 49 insertions(+) create mode 100644 .eleventy.js create mode 100644 .gitignore diff --git a/.eleventy.js b/.eleventy.js new file mode 100644 index 0000000..19a1431 --- /dev/null +++ b/.eleventy.js @@ -0,0 +1,47 @@ +module.exports = function (eleventyConfig) { + // Collection: all posts sorted by date descending + eleventyConfig.addCollection("posts", function (collectionApi) { + return collectionApi + .getFilteredByGlob("blog/posts/**/*.md") + .sort((a, b) => b.date - a.date); + }); + + // Filter: human-readable date, e.g. "March 24, 2026" + eleventyConfig.addFilter("readableDate", function (date) { + return new Date(date).toLocaleDateString("en-US", { + year: "numeric", + month: "long", + day: "numeric", + }); + }); + + // Filter: aggregate tags across a post collection + // Returns [{tag, count}, ...] sorted by count desc, excluding "posts" + eleventyConfig.addFilter("tagCounts", function (posts) { + const counts = {}; + for (const post of posts) { + for (const tag of post.data.tags || []) { + if (tag === "posts") continue; + counts[tag] = (counts[tag] || 0) + 1; + } + } + return Object.entries(counts) + .map(([tag, count]) => ({ tag, count })) + .sort((a, b) => b.count - a.count); + }); + + // Pass through static assets + eleventyConfig.addPassthroughCopy("assets"); + + return { + dir: { + input: ".", + output: "_site", + includes: "_includes", + data: "_data", + }, + templateFormats: ["njk", "md", "html"], + markdownTemplateEngine: "njk", + htmlTemplateEngine: "njk", + }; +}; diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3a799fb --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +_site/