-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
70 lines (60 loc) · 2.13 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
67
68
69
70
// filters
const dateFilter = require("./src/filters/date-filter.js");
const w3DateFilter = require("./src/filters/w3-date-filter.js");
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
module.exports = (eleventyConfig) => {
// Add a callback to log navigation data during build
eleventyConfig.on('eleventy.after', () => {
console.log('Building navigation structure...');
});
// Add the navigation plugin with explicit config
eleventyConfig.addPlugin(eleventyNavigationPlugin, {
enableLiveReload: true
});
// add filters
eleventyConfig.addFilter("dateFilter", dateFilter);
eleventyConfig.addFilter("w3DateFilter", w3DateFilter);
eleventyConfig.setServerPassthroughCopyBehavior("passthrough");
// set directories to pass through to the dist folder
eleventyConfig.addPassthroughCopy("./src/favicon/");
eleventyConfig.addPassthroughCopy("css");
eleventyConfig.addPassthroughCopy({ "./src/fonts/": "/fonts/" });
eleventyConfig.addPassthroughCopy("**/photos/*.jpg");
eleventyConfig.addPassthroughCopy("**/photos/*.jpeg");
eleventyConfig.addPassthroughCopy("**/photos/*.png");
eleventyConfig.addPassthroughCopy("./src/icons/*.png");
eleventyConfig.addPassthroughCopy("./src/icons/*.gif");
// fix markdown links
eleventyConfig.addTransform(
"fixMarkdownLinks",
function (content, outputPath) {
if (outputPath && outputPath.endsWith(".html")) {
return content.replace(/href="([^"]+)\.md"/g, 'href="$1.html"');
}
return content;
}
);
// fix smartquotes
const markdownIt = require("markdown-it");
let options = {
html: true,
typographer: true,
};
let markdownLibrary = markdownIt(options);
eleventyConfig.setLibrary("md", markdownLibrary);
eleventyConfig.addCollection("navigationData", collection => {
console.log("Navigation collection being built");
return collection.getAll();
});
console.log("Eleventy configuration loaded");
return {
markdownTemplateEngine: "njk",
dataTemplateEngine: "njk",
htmlTemplateEngine: "njk",
dir: {
input: "src",
output: "dist",
data: "_data",
},
};
};