This repository has been archived by the owner on May 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
67 lines (55 loc) · 1.6 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
57
58
59
60
61
62
63
64
65
66
67
const markdownIt = require("markdown-it")
const markdownItAttrs = require("markdown-it-attrs")
const {outdent} = require("outdent")
module.exports = (config) => {
// set custom markdown
const mdOptions = {
html: true,
breaks: false,
linkify: true,
}
const markdownLib = markdownIt(mdOptions)
.use(markdownItAttrs)
.disable("code")
config.setLibrary("md", markdownLib)
// watching styles folder to gen sass
config.addWatchTarget("./assets/styles/")
// Passthrough for images & Assets
config.addPassthroughCopy('./_content/images/')
config.addPassthroughCopy('./assets/**/*')
// Aside shortcode
config.addPairedNunjucksShortcode("Aside", function (content, classes) {
const md = outdent`${markdownLib.render(content)}`
return `<aside ${classes ? `class="${classes}"` : ''}>${md}</aside>`
})
// Actions Collection
config.addCollection('actions', collection => {
let ordered = []
let unordered = []
const pages = collection.getFilteredByGlob('**/actions/*.md')
for (let page of pages) {
if (page.data.order) {
if (ordered[page.data.order]) {
ordered.splice(page.data.order, 0, page)
} else {
ordered[page.data.order] = page
}
} else {
unordered.push(page)
}
}
return ordered.concat(unordered)
})
return {
markdownTemplateEngine: 'njk',
dataTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
// pathPrefix: "/fondationmeyer.test/",
dir: {
includes: '../_includes/',
data: '../_data',
input: '_content',
output: '_site'
}
}
}