-
Notifications
You must be signed in to change notification settings - Fork 32
/
eleventy.config.js
69 lines (58 loc) · 2.18 KB
/
eleventy.config.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
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
"use strict";
const rssPlugin = require("@11ty/eleventy-plugin-rss");
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const fluidPlugin = require("eleventy-plugin-fluid");
// Import filters
const dateFilter = require("./src/_filters/date-filter.js");
const markdownFilter = require("./src/_filters/markdown-filter.js");
const w3DateFilter = require("./src/_filters/w3-date-filter.js");
// Import transforms
const parseTransform = require("./src/_transforms/parse-transform.js");
// Import data files
const site = require("./src/_data/site.json");
module.exports = function (config) {
// Filters
config.addFilter("dateFilter", dateFilter);
config.addFilter("markdownFilter", markdownFilter);
config.addFilter("w3DateFilter", w3DateFilter);
// Transforms
config.addTransform("parse", parseTransform);
// Passthrough copy
config.addPassthroughCopy({"src/assets/images": "assets/images"});
config.addPassthroughCopy({"src/assets/js": "assets/js"});
config.addPassthroughCopy({"src/lib": "lib"});
config.addPassthroughCopy({"src/assets/stylesheets": "assets/stylesheets"});
config.addPassthroughCopy({"src/news/images": "news/images"});
// Custom collections
config.addCollection("news", collection => {
return [
...collection.getFilteredByGlob("./src/news/*.md")
];
});
// The following collection is used to distribute posts into different pages. However, the default pagination has not been set in fluidproject.org and all posts are shown on single page
config.addCollection("postFeed", collection => {
return [...collection.getFilteredByGlob("./src/news/*.md")]
.reverse()
.slice(0, site.maxPostsPerPage);
});
// Plugins
config.addPlugin(rssPlugin);
config.addPlugin(syntaxHighlight);
config.addPlugin(fluidPlugin, {
css: {
enabled: false
},
i18n: false,
sass: {
enabled: false
}
});
return {
dir: {
input: "src"
},
templateFormats: ["html", "md", "njk"],
htmlTemplateEngine: "liquid",
passthroughFileCopy: true
};
};