Moving rooted templates to directories.
kylesloper opened this issue · comments
I have moved authors.njk
, author.njk
and tags.njk
to my layouts
directory and it is causing strange behaviour, is there something I need to update in order to do this.
I have also added 404.md
to my pages
directory and this also is causing some strange things to happen.
I moved these files purely to clean things up a little bit so if there is absolutely no way to get around this then let me know and I'll just keep the files where they are.
authors.njk
, author.njk
, and tags.njk
are pagination templates and therefore (in this case) they need to be placed in the Eleventy root.
If you wanted to you could put them inside a data directory e.g. /authors/ or /tags/ also inside the Eleventy root.
You wouldn’t put them inside the _/layouts/includes/ directory because they aren’t includes - they are at the top level of the template hierarchy.
Again, 404.md
outputs a file 404.html
into the root output directory _/site/
, which is where it needs to be for Netlify to pick it up and use it to display a custom 404 page when required.
I feel that it's easier for those learning 11ty to understand the nature of these files if they are kept inside the project root.
Thanks, that's really helpful to know.