-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
62 lines (53 loc) · 1.68 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
const glob = require('fast-glob')
const {EleventyI18nPlugin} = require('@11ty/eleventy');
const i18n = require('eleventy-plugin-i18n')
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const translations = require('./src/_data/i18n')
module.exports = function (eleventyConfig) {
/* -------- Collection -------- */
glob.sync('./config/collections/*.js').forEach((file) => {
let collection = require('./' + file);
Object.keys(collection).forEach((name) => {
eleventyConfig.addCollection(name, collection[name]);
});
});
/* -------- Filters -------- */
glob.sync('./config/filters/*.js').forEach((file) => {
let filters = require('./' + file);
Object.keys(filters).forEach((name) => {
eleventyConfig.addFilter(name, filters[name]);
});
});
/* -------- Plugins -------- */
glob.sync('./config/template-languages/*.js').forEach((file) => {
let plugin = require('./' + file)
eleventyConfig.addPlugin(plugin)
});
eleventyConfig.addPlugin(EleventyI18nPlugin, {
defaultLanguage: 'es'
});
eleventyConfig.addPlugin(i18n, {
translations,
fallbackLocales: {
'*': 'es'
}
});
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addWatchTarget('./src/assets');
eleventyConfig.addPassthroughCopy('src/assets/fonts/')
eleventyConfig.addPassthroughCopy({
'./src/assets/images/favicon/*': '/'
});
return {
dir: {
input: 'src',
output: '_site',
includes: '_includes',
layouts: '_layouts'
},
markdownTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
}
};