generated from MaybeThisIsRu/smix-eleventy-starter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eleventy.js
51 lines (43 loc) · 1.36 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module.exports = function(config) {
const filters = require("./ssg/filters");
const shortcodes = require("./ssg/shortcodes");
const utils = require("./ssg/utils");
const isProduction = process.env.NODE_ENV === "production" ? true : false;
// *** Misc Options
// Additional files to watch for changes
config.addWatchTarget("./ssg/");
// *** Plugins
// Nothing here right now.
// *** Shortcodes
// Jekyll replacement for post_url tag as an 11ty shortcode
config.addShortcode("getUrl", shortcodes.postUrl);
config.addShortcode("isOldPost", shortcodes.isOldPost);
config.addShortcode("getAlleppRate", shortcodes.getAlleppRate);
// *** Filters
// Dates
config.addFilter("friendlyDate", filters.friendlyDate);
config.addFilter("dateInISO8601", filters.dateInISO8601);
// Filter specified collection by tag
config.addFilter("byTag", filters.byTag);
// *** Internal filter functions
// const liveItems = item => item.date <= new Date();
const publishedItems = item => (isProduction ? !item.data.draft : true);
// *** Collections
// Blog posts
config.addCollection("posts", collection => {
return collection
.getFilteredByGlob("posts/*.md")
.filter(publishedItems)
.reverse();
});
return {
pathPrefix: "/", // useful for GitHub pages
dir: {
input: "./",
output: "./dist",
includes: "includes",
layouts: "layouts",
data: "data"
}
};
};