-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
53 lines (48 loc) · 1.5 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
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const markdownIt = require("markdown-it");
const markdownItFootnote = require("markdown-it-footnote");
const iterlinker = require("@photogabble/eleventy-plugin-interlinker");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const STATIC_FILES = [
"img",
"icons",
"scripts",
"favicon.ico",
"styles",
"_redirects",
];
module.exports = function (eleventyConfig) {
// BEGIN: First-party filters.
eleventyConfig.addFilter("filter", (arr, key, value) => {
return arr.filter((item) => item.data[key] === value);
});
eleventyConfig.addFilter("readablePostDate", (dateObj) => {
try {
return dateObj.toISOString().split("T")[0];
} catch {
return dateObj;
}
});
eleventyConfig.addFilter("toStars", (rating) => {
return "★".repeat((rating + 1) / 2);
});
eleventyConfig.addCollection("statistics", (collectionAPI) => {
return [];
});
// END: First-party filters.
eleventyConfig.addPassthroughCopy({
"style.out.css": "style.css",
});
STATIC_FILES.forEach((file) => {
eleventyConfig.addPassthroughCopy(file);
});
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(iterlinker, {});
let options = {
html: true, // Enable HTML tags in source
linkify: true, // Autoconvert URL-like text to links
};
let markdownLib = markdownIt(options).use(markdownItFootnote);
eleventyConfig.setLibrary("md", markdownLib);
};