forked from netlify/ask-netlify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
43 lines (36 loc) · 1.17 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
module.exports = function(eleventyConfig) {
// Get only content that matches a tag
eleventyConfig.addCollection("episodes", function(collection) {
return collection.getFilteredByTag("episode");
});
// Nunjucks question link Shortcode
eleventyConfig.addNunjucksShortcode("qlink", function(number) {
return `<a href="https://github.com/netlify/ask-netlify/issues/${number}" class="question-link" target="_BLANK" rel="noopener">Question #${number}</a>`
});
// RSS plugin
const pluginRss = require("@11ty/eleventy-plugin-rss");
eleventyConfig.addPlugin(pluginRss);
// minify the html output
const htmlmin = require("html-minifier");
eleventyConfig.addTransform("htmlmin", function(content, outputPath) {
if( outputPath.endsWith(".html") ) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true
});
return minified;
}
return content;
});
// other config settings
return {
dir: {
input: "src/site",
output: "dist"
},
templateFormats : ["njk", "md"],
htmlTemplateEngine : "njk",
markdownTemplateEngine : "njk"
};
};