-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheleventy.config.js
66 lines (55 loc) · 2.39 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
57
58
59
60
61
62
63
64
65
66
// Enable type definitions: https://www.11ty.dev/docs/config/#type-definitions
/** @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig */
const pluginNavigation = require("@11ty/eleventy-navigation");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const pluginSyntax = require("@11ty/eleventy-plugin-syntaxhighlight");
const markdown = require("./src/_11ty/libraries/markdown-it");
const collections = require("./src/_11ty/collections");
const filters = require("./src/_11ty/filters");
const shortcodes = require("./src/_11ty/shortcodes");
const transforms = require("./src/_11ty/transforms");
module.exports = function (eleventyConfig) {
// Plugins
eleventyConfig.addPlugin(pluginNavigation);
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(pluginSyntax);
// Libraries
eleventyConfig.setLibrary("md", markdown.md);
// Collections
eleventyConfig.addCollection("posts", collections.posts);
eleventyConfig.addCollection("feed", collections.feed);
eleventyConfig.addCollection("latest", collections.latest);
eleventyConfig.addCollection("featured", collections.featured);
// Filters
eleventyConfig.addFilter("dateToDMY", filters.dateToDMY);
eleventyConfig.addFilter("dateToYYYYMMDD", filters.dateToYYYYMMDD);
eleventyConfig.addFilter("dateToTime", filters.dateToTime);
eleventyConfig.addFilter("dateToYear", filters.dateToYear);
eleventyConfig.addFilter("dateToMonth", filters.dateToMonth);
eleventyConfig.addFilter("dateToUNIX", filters.dateToUNIX);
eleventyConfig.addFilter("squash", filters.squash);
// Shortcodes
eleventyConfig.addShortcode("picture", shortcodes.picture);
eleventyConfig.addPairedShortcode("figure", shortcodes.figure);
// Transforms
eleventyConfig.addTransform("htmlmin", transforms.htmlmin);
// Passthrough copies
eleventyConfig.addPassthroughCopy({ "src/static/fonts": "/fonts" });
eleventyConfig.addPassthroughCopy({ "src/static/favicons/*": "/" });
eleventyConfig.addPassthroughCopy({ "src/static/js/*": "/js" });
eleventyConfig.addPassthroughCopy({
"src/static/og-default.png": "/og-default.png",
});
// Watch targets
eleventyConfig.addWatchTarget("./src/_styles/**/*.css");
return {
dir: {
input: "src",
output: "dist",
data: "_11ty/data",
},
templateFormats: ["html", "md", "njk", "11ty.js"],
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk",
};
};