forked from servo/servo.org
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eleventy.js
45 lines (39 loc) · 1.59 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
const MarkdownIt = require("markdown-it");
const MarkdownItAnchor = require("markdown-it-anchor");
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const pluginRss = require("@11ty/eleventy-plugin-rss");
module.exports = function(eleventyConfig) {
eleventyConfig.setTemplateFormats(["md", "njk", "html", "css", "pdf"]);
eleventyConfig.addPassthroughCopy("CNAME");
eleventyConfig.addPassthroughCopy({"assets/img": "img"});
eleventyConfig.addPassthroughCopy({"assets/svg": "svg"});
eleventyConfig.addPassthroughCopy({"node_modules/reveal.js/dist": "reveal.js/dist"});
eleventyConfig.addPassthroughCopy({"node_modules/reveal.js/plugin": "reveal.js/plugin"});
eleventyConfig.addPassthroughCopy({"slides": "slides"});
eleventyConfig.addShortcode("currentYear", () => `${new Date().getFullYear()}`);
eleventyConfig.setLibrary("md", MarkdownIt({
html: true,
typographer: true,
linkify: true
}).use(MarkdownItAnchor, {
permalink: MarkdownItAnchor.permalink.linkInsideHeader({
symbol: `
<span class="icon hashlink"><i class="fas fa-link"></i></span>
`,
})
}));
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addCollection("recentBlogPosts", (collectionApi) => {
let i =0;
return collectionApi.getFilteredByTag("blog").reverse().filter((item) => {
return i++ < 10;
});
})
eleventyConfig.addCollection("frontpageBlogPosts", (collectionApi) => {
let i =0;
return collectionApi.getFilteredByTag("blog").reverse().filter((item) => {
return i++ < 4;
});
})
}