-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eleventy.config.js
More file actions
71 lines (53 loc) · 2.02 KB
/
.eleventy.config.js
File metadata and controls
71 lines (53 loc) · 2.02 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
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
70
71
// const htmlmin = require("html-minifier")
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
module.exports = eleventyConfig => {
eleventyConfig.addPlugin(syntaxHighlight);
// Add a readable date formatter filter to Nunjucks
eleventyConfig.addFilter("dateDisplay", require("./filters/dates.js"))
// Add a HTML timestamp formatter filter to Nunjucks
eleventyConfig.addFilter("htmlDateDisplay", require("./filters/timestamp.js"))
// // Minify our HTML
// eleventyConfig.addTransform("htmlmin", (content, outputPath) => {
// if ( outputPath.endsWith(".html") )
// {
// let minified = htmlmin.minify(content, {
// useShortDoctype: true,
// removeComments: true,
// collapseWhitespace: true
// })
// return minified
// }
// return content
// })
// // Collections
// eleventyConfig.addCollection('blog', collection => {
// const blogs = collection.getFilteredByTag('blog')
// for( let i = 0; i < blogs.length; i++ ) {
// const prevPost = blogs[i - 1]
// const nextPost = blogs[i + 1]
// blogs[i].data["prevPost"] = prevPost
// blogs[i].data["nextPost"] = nextPost
// }
// return blogs.reverse()
// })
// Layout aliases
eleventyConfig.addLayoutAlias('default', 'layouts/default.njk')
// eleventyConfig.addLayoutAlias('post', 'layouts/post.njk')
// Include our static assets
eleventyConfig.addPassthroughCopy("css")
eleventyConfig.addPassthroughCopy("js")
eleventyConfig.addPassthroughCopy("images")
eleventyConfig.addPassthroughCopy("robots.txt")
return {
templateFormats: ["md", "njk"],
markdownTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
passthroughFileCopy: true,
dir: {
input: 'input',
output: 'dist',
includes: 'includes',
data: 'globals'
}
}
}