-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eleventy.js
63 lines (57 loc) · 2.16 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 yaml = require("js-yaml");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const pluginNavigation = require("@11ty/eleventy-navigation");
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
// 11ty config files
const pluginMd = require("./.eleventy.md.js");
const pluginShortcodes = require("./.eleventy.shortcodes.js");
const pluginFilters = require("./.eleventy.filters.js");
const pluginI18n = require("./.eleventy.i18n.js");
const pluginTransforms = require("./.eleventy.transforms.js");
module.exports = function (eleventyConfig) {
eleventyConfig.addDataExtension("yaml", (contents) => yaml.load(contents));
eleventyConfig.addGlobalData("env", process.env.ELEVENTY_ENV);
// Plugins
eleventyConfig.addPlugin(pluginMd);
eleventyConfig.addPlugin(pluginShortcodes);
eleventyConfig.addPlugin(pluginFilters);
eleventyConfig.addPlugin(pluginI18n);
eleventyConfig.addPlugin(pluginNavigation);
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(pluginTransforms);
eleventyConfig.addPlugin(syntaxHighlight);
// Collections
eleventyConfig.addCollection("articlesEn", (collectionApi) => {
return collectionApi.getFilteredByGlob("src/en/articles/*/*.md").reverse();
});
eleventyConfig.addCollection("articlesRu", (collectionApi) => {
return collectionApi.getFilteredByGlob("src/ru/articles/*/*.md").reverse();
});
// Build options
eleventyConfig.addPassthroughCopy("src/manifest.json");
eleventyConfig.addPassthroughCopy("src/robots.txt");
eleventyConfig.addPassthroughCopy("src/fonts");
eleventyConfig.addPassthroughCopy("src/scripts");
eleventyConfig.addPassthroughCopy({ "src/assets/*.{svg,jpg,png}": "assets" });
eleventyConfig.addPassthroughCopy({
"src/assets/favicons/*.{svg,jpg,png,ico}": "assets/favicons",
});
eleventyConfig.addPassthroughCopy(
"src/(en|ru)/articles/**/*.(gif|jpg|png|webp|svg)"
);
return {
dir: {
input: "src",
output: "dist",
includes: "_includes",
layouts: "_templates",
data: "_data",
},
dataTemplateEngine: "njk",
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk",
passthroughFileCopy: true,
markdownTemplateEngine: false,
templateFormats: ["md", "njk"],
};
};