-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
38 lines (32 loc) · 1 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
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
module.exports = function(eleventyConfig) {
// Add plugins
eleventyConfig.addPlugin(eleventyNavigationPlugin);
eleventyConfig.addPlugin(syntaxHighlight);
// Copy the `css` directory to the output
eleventyConfig.addPassthroughCopy("css");
// Add dateToRfc822 filter
eleventyConfig.addFilter('dateToRfc822', function(date) {
return new Date(date).toUTCString();
});
// Add absoluteUrl filter
eleventyConfig.addFilter('absoluteUrl', function(url, base) {
try {
return new URL(url, base).toString();
} catch(e) {
console.error("Invalid URL:", url, base);
return url;
}
});
// Add htmlDateString filter (often used with absoluteUrl)
eleventyConfig.addFilter('htmlDateString', (dateObj) => {
return dateObj.toISOString().split('T')[0];
});
return {
dir: {
input: "src",
output: "public"
}
};
};