blob: 4bcf389c5013a00764c5db887fd1b7da4aa7d57d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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"
}
};
}
|