-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheleventy.config.mjs
48 lines (42 loc) · 1.53 KB
/
eleventy.config.mjs
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
import { EleventyI18nPlugin } from '@11ty/eleventy';
// skipcq: JS-0116
export default async function (eleventyConfig) {
// Configure Eleventy.
// Order matters, leave this at top of configuration file.
eleventyConfig.setLayoutsDirectory('_layouts'); // relative to input dir
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.addPassthroughCopy('assets');
eleventyConfig.addGlobalData('siteTitle', 'OpenINF');
eleventyConfig.addGlobalData(
'siteDescription',
'Aggregate, curate, disseminate, and apply information derived from diverse sources.'
);
eleventyConfig.addGlobalData('siteUrl', 'https://open.inf.is');
eleventyConfig.addGlobalData(
'env',
process.env.ELEVENTY_ENV || 'development'
);
// Drafts, see also _data/eleventyDataSchema.js.
eleventyConfig.addPreprocessor('drafts', '*', (data /*, content*/) => {
if (data.draft && process.env.ELEVENTY_ENV === 'production') {
return false;
}
return null;
});
eleventyConfig.addCollection('posts', (collectionApi) => {
return collectionApi
.getFilteredByGlob([
'collections/_posts/*.md',
'collections/_drafts/*.md',
])
.sort(
(a, b) => b.date - a.date // sort by date - descending
);
});
eleventyConfig.addPlugin(EleventyI18nPlugin, {
// Any valid BCP 47-compatible language tag is supported.
defaultLanguage: 'en', // required
// When to throw errors for missing localized content files.
errorMode: 'strict', // throw an error if content is missing at /en/slug
});
}