This is just a temporary repository to reproduce an issue I am having using metalsmith-include and metalsmith-layouts
When you view the head.md file, you can see that it sets the layout
value to head.pug, and when the head.md file itself is processed (not as a partial), it gets rendered just fine, as you can tell from the head.html file in the _build directory.
The problem occurs when head.md is included inside another markdown file within the source directory (such as hello-world.md). Inside hello-world.md, you can see that the head.md is included (and assigned to head
), and then the layout
is set to hello-world.pug, which outputs the content of head.md
on line 4. However, when the hello-world.html is generated, you'll notice that only the content of head.md is included, but none of the template data from head.pug.
After playing around with the order in which the metalsmith plugins metalsmith-include and metalsmith-layouts are executed, I noticed that if I put the layouts()
call either before or after include()
, the head.pug
template will not get rendered at all. However, if I put the layouts()
both before and after include()
, then head.md
is rendered using head.pug
just fine... But then the hello-world.pug
is included twice... I'm not sure what to make of this.