-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
47 lines (38 loc) · 1.47 KB
/
.eleventy.js
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
40
41
42
43
44
45
46
47
var moment = require('moment'); // require
const { EleventyRenderPlugin } = require("@11ty/eleventy");
const pluginRss = require("@11ty/eleventy-plugin-rss");
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(EleventyRenderPlugin);
eleventyConfig.addPlugin(pluginRss);
//passthrough
eleventyConfig.addPassthroughCopy("src/assets/");
eleventyConfig.addWatchTarget("src/assets/");
eleventyConfig.addPassthroughCopy("src/media/");
eleventyConfig.addPassthroughCopy("src/blog/");
eleventyConfig.addPassthroughCopy("src/writing/");
eleventyConfig.addPassthroughCopy("src/widgets/");
eleventyConfig.addPassthroughCopy("src/fan/");
eleventyConfig.addPassthroughCopy("png");
eleventyConfig.addPassthroughCopy("jpg");
eleventyConfig.addPassthroughCopy("webp");
eleventyConfig.addPassthroughCopy("js");
// filters
eleventyConfig.addFilter("formatDate", function (value) {
const date = moment(new Date(value)).utc().format("MMM DD, YYYY");
return date;
});
eleventyConfig.addFilter("formatDateShort", function (value) {
const date = moment(new Date(value)).utc().format("YYYY-MM-DD");
return date;
});
// collections
eleventyConfig.addCollection("posts", function (collectionApi) {
return collectionApi.getFilteredByGlob("src/blog/posts/**/*.md").reverse();
});
return {
dir: {
input: 'src',
output: 'public',
}
}
}