summaryrefslogtreecommitdiff
path: root/.eleventy.js
diff options
context:
space:
mode:
Diffstat (limited to '.eleventy.js')
-rw-r--r--.eleventy.js32
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"
+ }
+ };
+}
+