-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
111 lines (94 loc) · 3.15 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
const pluginRss = require("@11ty/eleventy-plugin-rss");
const pluginTOC = require('eleventy-plugin-toc');
const emoji = require('markdown-it-emoji');
const markdownItAnchor = require('markdown-it-anchor')
const wikilinks = require('@gardeners/markdown-it-wikilinks')
module.exports = function(eleventyConfig) {
// plugins
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(pluginTOC)
eleventyConfig.addLiquidFilter("dateToRfc3339", pluginRss.dateRfc3339);
// supported formats
eleventyConfig.setTemplateFormats([
"pug",
"njk",
"md",
"css",
"woff"
])
eleventyConfig.addPassthroughCopy("css")
eleventyConfig.addPassthroughCopy("assets")
eleventyConfig.addPassthroughCopy("images")
// filters
eleventyConfig.addFilter('md', (content)=> md.renderInline(content))
global.filters = eleventyConfig.javascriptFunctions;
eleventyConfig.setPugOptions({ // and here
globals: ['filters']
});
// custom markdown
let markdownIt = require("markdown-it")
let md = markdownIt({html: true, linkify: true })
.use(markdownItAnchor)
.use(emoji)
.use(wikilinks({
uriSuffix: '/',
postProcessLabel: (label) => {
return label.split('/')[label.split('/').length - 1]
},
}))
.use(require('./md-tufte/sidenote'))
.use(require('./md-tufte/marginnote'))
eleventyConfig.setLibrary("md", md)
eleventyConfig.addCollection("notices",
collection => collection
.getFilteredByGlob("./content/notices/*.md")
.sort((a,b) => {
let x = ((a.data.short) ? a.data.short: a.data.title).toLowerCase()
let y = ((b.data.short) ? b.data.short: b.data.title).toLowerCase()
return x.localeCompare(y)
})
)
eleventyConfig.addCollection("journal",
collection => collection
.getFilteredByGlob([
'./content/journal/*.md',
'./content/yo/*.md',
'./content/write.apreslanu.it/tk/*md',
'./content/write.apreslanu.it/offload/*.md'
])
.filter(x => !x.data.hidden)
)
eleventyConfig.addCollection("highlights",
collection => collection
.getFilteredByGlob("./content/highlights/*.md")
.sort((a,b)=> {
if (a.data.author.last > b.data.author.last) return 1;
else if (a.data.author.last < b.data.author.last) return -1;
else return 0;
})
)
eleventyConfig.addCollection("semaines",
collection => collection
.getFilteredByGlob([
'./content/semaines/*.md',
'./content/write.apreslanu.it/weeknotes/*.md'
])
)
eleventyConfig.addCollection("liens",
collection => collection
.getFilteredByGlob(['./content/liens/*.md'])
)
eleventyConfig
.addCollection("posts",
collection => collection
.getFilteredByGlob('./content/**/*.md')
.filter(x => x.inputPath != './README.md')
)
return {
dir: {
input: 'content',
includes: '../includes',
data: '../data'
}
}
}