diff options
| author | Shipwreckt <me@shipwreckt.co.uk> | 2025-11-02 20:32:56 +0000 |
|---|---|---|
| committer | Shipwreckt <me@shipwreckt.co.uk> | 2025-11-02 20:32:56 +0000 |
| commit | 0bf147512bb84d1a05d4c7cf1ec049c7a6b534d5 (patch) | |
| tree | 75517e797d6f6091bdc6c4b8b48b60b93474f463 /.eleventy.js | |
| parent | 7a52ddeba2a68388b544f529d2d92104420f77b0 (diff) | |
Diffstat (limited to '.eleventy.js')
| -rw-r--r-- | .eleventy.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/.eleventy.js b/.eleventy.js new file mode 100644 index 0000000..4bcf389 --- /dev/null +++ b/.eleventy.js @@ -0,0 +1,32 @@ +import { DateTime } from "luxon"; + +export default function(eleventyConfig) { + // Posts collection + eleventyConfig.addCollection("posts", collectionApi => { + return collectionApi + .getFilteredByGlob("./src/posts/*.{md,html}") + .sort((a, b) => b.date - a.date); + }); + + // Date formatting filter + eleventyConfig.addFilter("dateFormat", (dateObj, format = "MMMM dd, yyyy") => { + if (!dateObj) return ""; + return DateTime.fromJSDate(dateObj).toFormat(format); + }); + + // Passthrough for static assets + eleventyConfig.addPassthroughCopy("src/images"); + eleventyConfig.addPassthroughCopy("src/assets"); + + // Directory configuration + return { + htmlTemplateEngine: "njk", + markdownTemplateEngine: "njk", + dir: { + input: "src", + output: "public", + includes: "_includes" + } + }; +} + |
