-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
37 lines (32 loc) · 1.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
const Card = require('./src/_includes/components/Card');
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const { DateTime } = require("luxon");
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("src/assets/");
eleventyConfig.addPassthroughCopy("src/css/");
eleventyConfig.addWatchTarget("src/css/");
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addCollection('posts', function(collectionApi) {
return collectionApi.getFilteredByGlob('src/blog/posts/**/*.md').sort((a, b) => {
if (a.data.title > b.data.title) return -1;
else if (a.data.title < b.data.title) return 1;
else return 0;
});
})
eleventyConfig.addFilter("readablePostDate", (dateObj) => {
return DateTime.fromJSDate(dateObj, {
zone: "Europe/Rome",
}).setLocale('en').toLocaleString(DateTime.DATE_FULL);
});
return {
dir: {
input: "src",
includes: '_includes',
output: "public",
},
templateFormats: ['md', 'njk', 'html'],
markdownTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
dataTemplateEngine: 'njk'
};
};