Open mrtnmgs opened 1 year ago
You could add layout: false
(or "layout": false
in a directory data file) for each of the partials and then layout: mylayout.njk
for the main page in the folder. I'm not sure how you would include the pages properly though, maybe with the render plugin?
I'd also like to say that I think you already opened a ticket on the Discord forum for this issue! You'll will definitely get faster and better answers on there instead of here - most issues on this repo don't actively get responses.
Ok so from what I gather there's no 11ty way to do this... layout: false
sounds interesting I'll try that. And noted re: discord vs github issues. Thanks for taking the time
Is your feature request related to a problem? Please describe.
I often need to break the content of a page into several files in order to separate code and content. (If the content can only be injected in one place in the template, in many case this separation is not possible). As far as I understand all partials must live in the _includes directory. But it's awkward to have part of the content in one place and another part elsewhere:
I tried creating the partials where the page lives:
When I do this, a page is created for each partial. Adding the partials to
.eleventyignore
is not a working solution as hot reloading doesn't work anymore. It seems like partials have to live in the_includes
directory in order to be handled properly. I had the same issue whether I imported the partial file withinclude
orrenderFile
.The best I was able to come with is specifying a separate directory for the layouts in
.eleventy.js
and move the location of the includes directory closer to the content. But if I use partials in different locations on my site it will still be awkward.Maybe I'm thinking about this the wrong way? Is there another way to have different pieces of content injected in different places in a template?
Describe the solution you'd like
I think the simplest fix would be to allow several directories for includes: