Eleventy Configuration
Inside the directory template project, there is an .eleventy.js
file, for our configuration, plugins, filter collections data. It might look like this:
Filename .eleventy.js
module.exports = function(eleventyConfig) {
// Return your Object options:
// FILTERS
// ..
// COLLECTIONS
// ..
return {
dir: {
input: 'src/site/content/',
output: 'dist',
data: '../_data',
includes: '../_includes',
},
templateFormats: ['njk', 'md'],
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
passthroughFileCopy: false,
}
};
Add Filters
Inside .eleventy.js
you can also add filter to help generate specific HTML like parsing date time or hashing file productions
module.exports = function(config) {
// Return your Object options:
// FILTERS
config.addFilter('findByUrl', findByUrl);
// ...
config.addFilter('navigation', navigation);
config.addFilter('md', md);
};
Add Collections
If you have customs data or contents that needs to be filtered, we can use addCollection
module.exports = function(config) {
// Return your Object options:
// FILTERS
config.addFilter('findByUrl', findByUrl);
// ...
config.addFilter('navigation', navigation);
config.addFilter('md', md);
};
Also, you can config some collections data that need to generate inside the website.