generated from 5t3ph/11ty-netlify-jumpstart
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
56 lines (49 loc) · 1.68 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
// 11ty Plugins
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const eleventySass = require("@11tyrocks/eleventy-plugin-sass-lightningcss");
const eleventyGoogleFonts = require("eleventy-google-fonts");
// Helper packages
const slugify = require("slugify");
const markdownIt = require("markdown-it");
const markdownItAnchor = require("markdown-it-anchor");
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(eleventySass);
eleventyConfig.addPlugin(eleventyGoogleFonts);
eleventyConfig.addPassthroughCopy("./src/fonts");
eleventyConfig.addPassthroughCopy("./src/img");
eleventyConfig.addPassthroughCopy("./src/favicon.png");
eleventyConfig.addPassthroughCopy('./src/_redirects');
eleventyConfig.addShortcode("year", () => `${new Date().getFullYear()}`);
eleventyConfig.addFilter('categoryFilter', function(collection, category) {
if (!category) return collection;
const filtered = collection.filter(item => item.data.category == category)
return filtered;
});
/* Markdown Overrides */
let markdownLibrary = markdownIt({
html: true,
}).use(markdownItAnchor, {
permalink: markdownItAnchor.permalink.ariaHidden({
class: "tdbc-anchor",
space: false,
}),
level: [1, 2, 3],
slugify: (str) =>
slugify(str, {
lower: true,
strict: true,
remove: /["]/g,
}),
});
eleventyConfig.setLibrary("md", markdownLibrary);
return {
dir: {
input: "src",
output: "public",
layouts: "_layouts",
},
};
};