-
Notifications
You must be signed in to change notification settings - Fork 1
/
eleventy.config.cjs
39 lines (32 loc) · 988 Bytes
/
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
const YAML = require("yaml");
const image = import("./image.js");
const DIRECTORIES = {
// Relative to current directory.
input: "pages",
output: "build",
// Relative to "input" directory.
layouts: "../layouts",
includes: "../components",
data: "../data",
};
/**
* @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig Eleventy configuration
*/
module.exports = function (eleventyConfig) {
// Copy
eleventyConfig.setServerPassthroughCopyBehavior("passthrough");
eleventyConfig.addPassthroughCopy({ public: "/" });
// Data
eleventyConfig.addDataExtension("yaml", (content) => YAML.parse(content));
eleventyConfig.addGlobalData("layout", "default.njk");
eleventyConfig.addGlobalData("base", process.env.URL);
// Shortcodes
eleventyConfig.addShortcode("image", async (inputPath, preset) =>
(await image).generateImage(inputPath, preset),
);
return {
dir: DIRECTORIES,
markdownTemplateEngine: "njk",
};
};
module.exports.DIRECTORIES = DIRECTORIES;