-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy patheleventy.config.js
More file actions
128 lines (102 loc) · 4.41 KB
/
eleventy.config.js
File metadata and controls
128 lines (102 loc) · 4.41 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import toml from '@iarna/toml'
import { HtmlBasePlugin, IdAttributePlugin, RenderPlugin } from '@11ty/eleventy'
import { eleventyImageOnRequestDuringServePlugin } from '@11ty/eleventy-img'
import navigationPlugin from '@11ty/eleventy-navigation'
import syntaxPlugin from '@11ty/eleventy-plugin-syntaxhighlight'
import setupFilters from './config/filters.js'
import setupMarkdown from './config/markdown.js'
import setupShortcodes from './config/shortcodes.js'
/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */
export default async function(eleventyConfig) {
eleventyConfig.setQuietMode(true)
eleventyConfig.addDataExtension('toml', (contents) => toml.parse(contents))
eleventyConfig.setFrontMatterParsingOptions({
excerpt: true,
excerpt_separator: '<!--more-->'
})
// @see https://github.com/11ty/eleventy/blob/main/src/Engines/Liquid.js
// @see https://liquidjs.com/tutorials/options.html
eleventyConfig.setLiquidOptions({
extname: 'liquid',
jekyllWhere: true,
jsTruthy: true,
locale: 'fr-FR'
})
// @see https://www.11ty.dev/docs/languages/liquid/#shortcode-parameter-parsing
// eleventyConfig.setLiquidParameterParsing('builtin')
/**
* Configuration
*/
eleventyConfig.setInputDirectory('./source')
eleventyConfig.setDataDirectory('../_data'),
eleventyConfig.setIncludesDirectory('../_includes')
eleventyConfig.setLayoutsDirectory('../_includes/layouts')
eleventyConfig.setDataFileBaseName('index'),
eleventyConfig.setTemplateFormats(["html", "liquid", "md", "njk"])
eleventyConfig.ignores.add("source/talks/**/slides/**.md")
eleventyConfig.ignores.add("source/talks/**/_*.md")
eleventyConfig.ignores.add("source/_drafts/**/*.md")
// @see https://www.11ty.dev/docs/languages/webc/
eleventyConfig.addBundle('css')
eleventyConfig.addBundle('js')
// @see https://www.11ty.dev/docs/plugins/id-attribute/
eleventyConfig.addPlugin(IdAttributePlugin, {
checkDuplicates: false
})
// @see https://www.11ty.dev/docs/plugins/html-base/
eleventyConfig.addPlugin(HtmlBasePlugin)
// @see https://www.11ty.dev/docs/plugins/navigation/
eleventyConfig.addPlugin(navigationPlugin)
// @see https://www.11ty.dev/docs/plugins/render/
eleventyConfig.addPlugin(RenderPlugin)
// @see https://www.11ty.dev/docs/plugins/syntaxhighlight/
eleventyConfig.addPlugin(syntaxPlugin, {
codeAttributes: {},
preAttributes: {}
})
eleventyConfig.addPlugin(eleventyImageOnRequestDuringServePlugin)
/**
* Collections
*/
eleventyConfig.addCollection('photography-series', async collectionsApi => {
return collectionsApi.getFilteredByGlob('source/photography/**/index.md')
})
eleventyConfig.addCollection('randomPhotographySeries', async collectionsApi => {
return collectionsApi.getFilteredByGlob('source/photography/**/index.md')
.map(series => ({ series, sort: Math.random() }))
.sort((a, b) => a.sort - b.sort)
.map(({ series }) => series)
.slice(0, 6)
})
eleventyConfig.addCollection('posts', async collectionsApi => {
return collectionsApi.getFilteredByGlob('source/posts/**/*.md').toReversed()
})
eleventyConfig.addCollection('journal', async collectionsApi => {
return collectionsApi.getFilteredByGlob('source/journal/**/*.md').toReversed()
})
eleventyConfig.addCollection('reading-notes', async collectionsApi => {
return collectionsApi.getFilteredByGlob('source/reading-notes/**/index.md').toReversed()
})
eleventyConfig.addCollection('talks', async collectionsApi => {
return collectionsApi.getFilteredByGlob('source/talks/*/*.md').toReversed()
})
/**
* Filters
*/
eleventyConfig.addPassthroughCopy({
'public/.htaccess': '.htaccess',
'public': 'assets',
'node_modules/prismjs': 'assets/prismjs/',
'node_modules/maplibre-gl/dist/maplibre-gl.js': 'assets/maplibre-gl/maplibre-gl.js',
'node_modules/maplibre-gl/dist/maplibre-gl.css': 'assets/maplibre-gl/maplibre-gl.css',
'node_modules/reveal.js/dist': 'assets/reveal/',
'node_modules/reveal-random-colors': 'assets/reveal/plugin/random-colors',
'node_modules/normalize.css/normalize.css': 'assets/css/normalize.css',
})
eleventyConfig.addPassthroughCopy('images')
eleventyConfig.addPassthroughCopy('source/talks/**/*.{png,jpg,jpeg,webp,gif}')
eleventyConfig.addPassthroughCopy('source/journal/**/*.{webp,avif,geojson}')
setupFilters(eleventyConfig)
setupShortcodes(eleventyConfig)
setupMarkdown(eleventyConfig)
}