-
Notifications
You must be signed in to change notification settings - Fork 2
/
eleventy.config.cjs
88 lines (80 loc) · 2.7 KB
/
eleventy.config.cjs
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// External imports
const pluginFavicons = require("eleventy-plugin-gen-favicons");
const { EleventyHtmlBasePlugin: pluginHtmlBase } = require("@11ty/eleventy");
const pluginNavigation = require("@11ty/eleventy-navigation");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const pluginVite = require("@11ty/eleventy-plugin-vite");
const pluginWebC = require("@11ty/eleventy-plugin-webc");
// Internal imports
module.exports = function (eleventyConfig) {
// External plugins
eleventyConfig.addPlugin(pluginFavicons, { generateManifest: false });
eleventyConfig.addPlugin(pluginHtmlBase);
eleventyConfig.addPlugin(pluginNavigation);
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(pluginSyntaxHighlight, {
preAttributes: { tabindex: 0 },
});
eleventyConfig.addPlugin(pluginVite);
eleventyConfig.addPlugin(pluginWebC, {
components: "src/_includes/components/**/*.webc",
});
// Internal plugins
eleventyConfig.addPlugin(require("./src/_11ty/plugins/drafts.cjs"));
eleventyConfig.addPlugin(require("./src/_11ty/plugins/image.cjs"));
eleventyConfig.addPlugin(require("./src/_11ty/plugins/wikilinks.cjs"));
// Filters
eleventyConfig.addFilter("limit", require("./src/_11ty/filters/limit.cjs"));
eleventyConfig.addFilter("unique", require("./src/_11ty/filters/unique.cjs"));
eleventyConfig.addFilter(
"readableDate",
require("./src/_11ty/filters/readableDate.cjs")
);
eleventyConfig.addFilter(
"htmlDateString",
require("./src/_11ty/filters/htmlDateString.cjs")
);
eleventyConfig.addFilter(
"getAllTags",
require("./src/_11ty/filters/getAllTags.cjs")
);
eleventyConfig.addFilter(
"filterTagList",
require("./src/_11ty/filters/filterTagList.cjs")
);
eleventyConfig.addFilter(
"excerpt",
require("./src/_11ty/filters/excerpt.cjs")
);
eleventyConfig.addFilter(
"addNonBreakingSpace",
require("./src/_11ty/filters/addNonBreakingSpace.cjs")
);
eleventyConfig.addFilter("newUrl", require("./src/_11ty/filters/newUrl.cjs"));
// Shortcodes
eleventyConfig.addShortcode(
"figure",
require("./src/_11ty/shortcodes/figure.cjs")
);
// Collections
const types = ["article", "bookmark"];
for (const type of types) {
eleventyConfig.addCollection(type, (collectionApi) =>
collectionApi.getAll().filter((item) => item.data.type === type)
);
}
// Passthrough copy
eleventyConfig.addPassthroughCopy({ "src/assets": "assets" });
return {
templateFormats: ["html", "md", "njk", "webc"],
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk",
dir: {
input: "src/content",
includes: "../_includes", // Relative to input
data: "../_data", // Relative to input
output: "_site",
},
};
};