-
Notifications
You must be signed in to change notification settings - Fork 0
/
eleventy.config.js
56 lines (54 loc) · 1.83 KB
/
eleventy.config.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
const { getPosts, getProjects } = require("./config/collections/index.js");
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
function configureMarkdownIt() {
// Reference: https://github.com/markdown-it/markdown-it-container/issues/23
return require("markdown-it")({ html: true })
.use(require("markdown-it-attrs"))
.use(require("markdown-it-container"), "dynamic", {
validate: function () {
return true;
},
render: function (tokens, idx) {
const token = tokens[idx];
if (token.nesting === 1) {
return '<div class="' + token.info.trim() + '">';
} else {
return "</div>";
}
},
});
}
module.exports = (eleventyConfig) => {
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addCollection("posts", getPosts);
eleventyConfig.addCollection("projects", getProjects);
[
"src/assets/fonts/",
"src/assets/images/",
"src/assets/css/",
"src/assets/files",
].forEach((path) => eleventyConfig.addPassthroughCopy(path));
eleventyConfig.addPassthroughCopy({
"src/assets/images/favicon/*": "/",
});
eleventyConfig.addPassthroughCopy({
"src/assets/staticroot/*": "/",
});
eleventyConfig.addPlugin(eleventyNavigationPlugin);
eleventyConfig.setLibrary("md", configureMarkdownIt());
return {
// Pre-process *.md, *.html and global data files files with: (default: `liquid`)
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk",
dataTemplateEngine: "njk",
// Optional (default is set): If your site deploys to a subdirectory, change `pathPrefix`, for example with with GitHub pages
pathPrefix: "/",
dir: {
input: "src",
output: "dist",
includes: "_includes",
layouts: "_layouts",
},
};
};