My solution is to put all of my template files in a directory called pages
. In my .eleventy.js
config, I set my input to pages
. Ex:
module.exports = eleventyConfig => {
return {
dir: {
input: 'pages',
}
};
};
Then, following the Eleventy documentation, you can set a JSON file in pages
called pages.json
. That file should look like the following:
{
"layout": "default"
}
And with that, all of my pages, the index page included, default to the default layout. If you need to override a page, you can include the layout in the frontmatter. Or if you want to override everything in the directory, just include a <directory-name>.json
file in that directory with the layout specified.
I haven't personally ran into any issues with this setup, and it is an added bonus to keep all of my templates together and not mixed with other config files as well.