-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
46 lines (37 loc) · 1.27 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
const pluginRss = require('@11ty/eleventy-plugin-rss');
const markdownIt = require('markdown-it');
const util = require('util');
const { DateTime } = require('luxon');
module.exports = (eleventyConfig) => {
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPassthroughCopy('./src/css');
eleventyConfig.addPassthroughCopy('./src/img');
eleventyConfig.addFilter('md', function (content = '') {
return markdownIt({ html: true }).render(content);
});
eleventyConfig.addFilter('postDate', (dateObj) => {
return DateTime.fromISO(dateObj, { zone: 'utc' }).toFormat('LLLL dd, yyyy');
});
eleventyConfig.setFrontMatterParsingOptions({
excerpt: true,
excerpt_separator: '<!--excerpt-->',
});
eleventyConfig.addCollection('blog', function (collection) {
return collection.getAll().filter((item) => item.data.posts);
});
eleventyConfig.addCollection('recentPosts', function (collection) {
return collection.getFilteredByTag('posts').reverse().slice(0, 3);
});
// eleventyConfig.addFilter('recentLinks', function (links) {
// return collections.links.reverse().slice(0, 3);
// });
eleventyConfig.addFilter('dump', (obj) => {
return util.inspect(obj);
});
return {
dir: {
input: 'src',
output: 'public',
},
};
};