-
Notifications
You must be signed in to change notification settings - Fork 43
/
.eleventy.js
66 lines (52 loc) · 2.06 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
65
66
const snippets = require("./lib/filters/snippets");
module.exports = function(eleventyConfig) {
eleventyConfig.setDataDeepMerge(true);
eleventyConfig.setLiquidOptions({
dynamicPartials: false,
});
// enable generation of header anchor tags
// needs the markdown-it-anchor plugin
const markdownIt = require("markdown-it");
const markdownItAnchor = require("markdown-it-anchor");
const options = {
html: true
};
// add anchor generation to markdown
// needed for toc plugin to work
const markdownLib = markdownIt(options).use(markdownItAnchor);
eleventyConfig.setLibrary("md", markdownLib);
// table of contents plugin
const pluginTOC = require('eleventy-plugin-nesting-toc');
eleventyConfig.addPlugin(pluginTOC, {tags: ['h2', 'h3']});
// syntax highlighting plugin
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
eleventyConfig.addPlugin(syntaxHighlight);
// copy static files to output
eleventyConfig.addPassthroughCopy("./content/bootstrap");
eleventyConfig.addPassthroughCopy("./content/css/*.css");
eleventyConfig.addPassthroughCopy("./content/images");
eleventyConfig.addPassthroughCopy("./content/.htaccess");
eleventyConfig.addPassthroughCopy("./content/doap_PDFBox.rdf");
eleventyConfig.addPassthroughCopy("./content/download.cgi");
eleventyConfig.addCollection("posts", function(collectionApi) {
return collectionApi.getFilteredByGlob("./content/_posts/*.md");
});
eleventyConfig.addCollection("docs", function(collectionApi) {
return collectionApi.getAll().filter(function(item) {
return item.data.eleventyNavigation !== undefined;
});
});
eleventyConfig.addLiquidShortcode('codesnippet', async function(url, version) {
return await snippets(url, version);
});
eleventyConfig.addFilter('navigation', require("./lib/filters/navigation.js"));
eleventyConfig.addWatchTarget("./content/css");
eleventyConfig.addWatchTarget("./content/_sass");
return {
dir: {
input: "content",
layouts: "_layouts",
output: "staging/content"
}
};
};