This repository has been archived by the owner on Mar 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
64 lines (55 loc) · 1.61 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
64
const glob = require('fast-glob');
module.exports = function (eleventyConfig) {
// Filters
glob.sync('{_11ty,_netlify}/filters/*.js').forEach(file => {
let filters = require('./' + file);
Object.keys(filters).forEach(name => {
eleventyConfig.addFilter(name, filters[name])
});
});
// Shortcodes
glob.sync('{_11ty,_netlify}/shortcodes/*.js').forEach(file => {
let shortcodes = require('./' + file);
Object.keys(shortcodes).forEach(name => {
eleventyConfig.addShortcode(name, shortcodes[name])
});
});
// Paired shortcodes
glob.sync('{_11ty,_netlify}/pairedShortcodes/*.js').forEach(file => {
let paired = require('./' + file);
Object.keys(paired).forEach(name => {
eleventyConfig.addPairedShortcode(name, paired[name])
});
});
// Collections
eleventyConfig.addCollection('navigation', collection => {
return require('./_11ty/filters/navigation.js').buildNavigation(collection.getAllSorted());
});
// Markdown engine & plugins
eleventyConfig.setLibrary(
'md',
require('markdown-it')({
html: true,
linkify: true,
typographer: true
})
.use(require('markdown-it-attrs'), {
allowedAttributes: ['id', 'class']
})
.use(require('markdown-it-emoji/light'))
);
eleventyConfig.setDataDeepMerge(true);
return {
templateFormats: ['html', 'md', 'njk', '11ty.js'],
markdownTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
dataTemplateEngine: 'njk',
dir: {
input: './site',
layouts: '_theme',
includes: '_theme/includes',
data: '_data',
output: './public'
}
}
}