-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheleventy.config.mjs
41 lines (34 loc) · 1.32 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
import { DateTime } from "luxon";
export default async function (eleventyConfig) {
eleventyConfig.addFilter("relativeTime", function (timestamp) {
const dateTime = DateTime.fromISO(timestamp);
return dateTime.toRelative();
});
eleventyConfig.addFilter("dateOnly", function (timestamp) {
const dateTime = DateTime.fromISO(timestamp);
return dateTime.setLocale('en-us').toLocaleString(DateTime.DATE_FULL);
});
eleventyConfig.addFilter("isInPast", function (timestamp) {
const dateTime = DateTime.fromISO(timestamp);
const today = DateTime.now();
return dateTime < today;
});
eleventyConfig.addFilter("isActiveCall", function (calls) {
return calls.filter(call => call.active || (!call.active && Date.now() < new Date(call.gracePeriod)));
});
eleventyConfig.addShortcode("currentYear", () => `${new Date().getFullYear()}`);
eleventyConfig.addPassthroughCopy('www/rss.xml');
eleventyConfig.addPassthroughCopy('www/public/favicon');
eleventyConfig.addPassthroughCopy({
'./node_modules/alpinejs/dist/cdn.min.js': './public/js/alpine.min.js',
});
}
export const config = {
htmlTemplateEngine: "njk",
dir: {
input: "www",
includes: "_includes",
data: "_data",
output: "public"
},
}