-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheleventy.config.js
32 lines (29 loc) · 1.06 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
// TODO consider using eleventy as the final builder/processor and using parcel only for js bundling
// rather than having eleventy only for templates and parcel for bundling everything
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight")
const mdk = require("markdown-it-katex")
/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(syntaxHighlight)
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(mdk))
// attempts to extracts a mini excerpt preview given a post
// uses the first paragraph as the excerpt's content
eleventyConfig.addFilter("excerpt", (postContent) => {
if (!postContent) return ""
const firstP = postContent.indexOf("<p>")
if (firstP >= 0) {
const endP = postContent.indexOf("</p>")
return postContent.substr(firstP, endP + 4)
}
return ""
})
return {
dir: {
input: "pages",
output: "_site",
includes: "_includes",
layouts: "_layouts",
},
passthroughFileCopy: true,
}
}