-
Notifications
You must be signed in to change notification settings - Fork 0
/
eleventy.config.js
69 lines (57 loc) · 2.25 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
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
import svgContents from 'eleventy-plugin-svg-contents'
import eleventyNavigationPlugin from '@11ty/eleventy-navigation'
import pluginRss from '@11ty/eleventy-plugin-rss'
import syntaxHighlight from '@11ty/eleventy-plugin-syntaxhighlight'
import contentTags from './utils/content-tags.js'
import optimizeCSS from './utils/optimize-css.js'
import tagList from './utils/tag-list.js'
import excerpt from 'eleventy-plugin-excerpt'
import { getWebmentionsForUrl, webmentionsByType } from './utils/webmentions.js'
import pluralize from './utils/pluralize.js'
export default async function (eleventyConfig) {
eleventyConfig.addPassthroughCopy({ 'static/img': 'img' })
eleventyConfig.addPassthroughCopy({ 'static/favicons': 'favicons' })
eleventyConfig.addPassthroughCopy({ 'static/cv': 'cv' })
eleventyConfig.addPassthroughCopy({ 'static/slides': 'slides' })
// merge it deep
eleventyConfig.setDataDeepMerge(true)
// handle SVG contents
eleventyConfig.addPlugin(svgContents)
// filter and sort nav items
eleventyConfig.addPlugin(eleventyNavigationPlugin)
// syntax highlighting
eleventyConfig.addPlugin(syntaxHighlight)
// generate RSS
eleventyConfig.addPlugin(pluginRss)
// add excerpt tag
eleventyConfig.addPlugin(excerpt)
// pretty date
eleventyConfig.addFilter('prettyDate', dateObj =>
dateObj.toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric',
})
)
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
eleventyConfig.addFilter('htmlDateString', dateObj => dateObj.toISOString())
eleventyConfig.addFilter('getWebmentionsForUrl', getWebmentionsForUrl)
eleventyConfig.addFilter('webmentionsByType', webmentionsByType)
eleventyConfig.addFilter('absoluteUrl', pluginRss.absoluteUrl)
eleventyConfig.addFilter('htmlToAbsoluteUrls', pluginRss.htmlToAbsoluteUrls)
eleventyConfig.addFilter('dateToRfc3339', pluginRss.dateToRfc3339)
eleventyConfig.addFilter('pluralize', pluralize)
// generate tags
eleventyConfig.addCollection('tagList', tagList)
eleventyConfig.addFilter('contentTags', contentTags)
eleventyConfig.addTransform('optimizeCSS', optimizeCSS)
return {
dir: {
data: '../data',
// set src dir to `site`
input: 'site',
includes: '../includes',
layouts: '../layouts',
},
}
}