-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.eleventy.js
More file actions
39 lines (36 loc) · 1.33 KB
/
.eleventy.js
File metadata and controls
39 lines (36 loc) · 1.33 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
import { EleventyHtmlBasePlugin } from "@11ty/eleventy";
import pluginRss from "@11ty/eleventy-plugin-rss";
import dateToISO8601 from "./src/scripts/dateToISO8601.js";
export default (eleventyConfig) => {
eleventyConfig.addPassthroughCopy("src/assets");
eleventyConfig.addPlugin(EleventyHtmlBasePlugin, {
baseHref: (process.env.NODE_ENV === "production" ? "https://until.tsukuba.dev" : "http://localhost:8080")
});
eleventyConfig.addPlugin(pluginRss, {
posthtmlRenderOptions: {
closingSingleTag: "slash"
}
});
eleventyConfig.addPassthroughCopy({
"./node_modules/@exampledev/new.css/new.css" : "/assets/css/new.css"
})
eleventyConfig.addNunjucksFilter("getNewestCollectionItemDate", pluginRss.getNewestCollectionItemDate)
eleventyConfig.addNunjucksFilter("dateToRfc3339", pluginRss.dateToRfc3339)
eleventyConfig.addNunjucksFilter("dateToISO8601", dateToISO8601);
eleventyConfig.addNunjucksFilter("date", function(str) {
return new Date(str);
});
eleventyConfig.addNunjucksFilter("futureEvents", (events, limit) => {
const now = new Date();
return events
.filter(event => new Date(event.data.dtstart) >= now)
.sort((a, b) => new Date(a.data.dtstart) - new Date(b.data.dtstart))
.slice(0, limit);
});
return {
dir: {
input: "src",
output: "public",
}
}
}