-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eleventy.js
More file actions
39 lines (32 loc) · 1.17 KB
/
.eleventy.js
File metadata and controls
39 lines (32 loc) · 1.17 KB
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
33
34
35
36
37
38
39
const { DateTime } = require("luxon");
module.exports = function (eleventyConfig) {
// Layout aliases can make templates more portable
eleventyConfig.addLayoutAlias('default', 'layouts/base.njk');
// blogpost collection
eleventyConfig.addCollection("posts", function (collection) {
return collection.
getFilteredByGlob("./src/site/posts/*.md")
.filter((item) => {
return 'date' in item.data;
});
});
// Add some utility filters
//eleventyConfig.addFilter("squash", require("./src/filters/squash.js"));
eleventyConfig.addFilter("dateDisplay", (dateObj, format = "LLLL d, y") => {
return DateTime.fromJSDate(dateObj, {
zone: "utc"
}).toFormat(format);
});
// minify the html output
//eleventyConfig.addTransform("htmlmin", require("./src/utils/minify-html.js"));
// pass some assets right through
// eleventyConfig.addPassthroughCopy("./src/assets/img");
return {
templateFormats: ["njk", "md"],
passthroughFileCopy: true,
dir: {
input: "src/site",
output: "dist"
}
};
};