-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
63 lines (50 loc) · 1.93 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const pluginNavigation = require("@11ty/eleventy-navigation");
const rssPlugin = require('@11ty/eleventy-plugin-rss');
const slugify = require("slugify");
// Filters
const dateFilter = require('./src/filters/date-filter.js');
const w3DateFilter = require('./src/filters/w3-date-filter.js');
// Create a helpful production flag
const isProduction = process.env.NODE_ENV === 'production';
const sortByDisplayOrder = require('./src/utils/sort-by-display-order.js');
module.exports = config => {
config.setDataDeepMerge(true);
// Add filters
config.addFilter('dateFilter', dateFilter);
config.addFilter('w3DateFilter', w3DateFilter);
// Plugins
config.addPlugin(rssPlugin);
config.addPlugin(pluginNavigation);
// Returns work items, sorted by display order
config.addCollection('socialLinks', collection => {
return sortByDisplayOrder(collection.getFilteredByGlob('./src/links/*.md'));
});
// Returns work items, sorted by display order
config.addCollection('work', collection => {
return sortByDisplayOrder(collection.getFilteredByGlob('./src/work/*.md'));
});
// Returns work items, sorted by display order then filtered by featured
config.addCollection('featuredWork', collection => {
return sortByDisplayOrder(
collection.getFilteredByGlob('./src/work/*.md')
).filter(x => x.data.featured);
});
// Returns a collection of blog posts in reverse date order
config.addCollection('blog', collection => {
return [...collection.getFilteredByGlob('./src/posts/*.md')].reverse();
});
// Tell 11ty to use the .eleventyignore and ignore our .gitignore file
config.setUseGitIgnore(false);
config.addPassthroughCopy("src/images");
config.addPassthroughCopy("src/css");
config.addPassthroughCopy('src/admin')
return {
markdownTemplateEngine: 'njk',
dataTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
dir: {
input: 'src',
output: 'dist'
}
};
};