I am using partials in nanoc, and I was wondering if it's possible to nest partials in nanoc. In other words, can I have a partial within a partial?
When I tested this, the site compiled, but the nested partial did not display.
I'm using the Partials implementation described in this stackoverflow post: Must include files in nanoc always be in the layouts folder?
While nested partials are not required for what we're trying to do, I was just wondering if this is possible.
Thank you in advance.
Yes, you can use nested partials with nanoc. Here's a way to demonstrate this:
Create a new site using nanoc.
From within the site directory, create the folder
content/partials
.Create the "outer" and "inner" partial content. In the file
content/partials/_outer.html
, place:And in the file
content/partials/_inner.html
:Note that we now have one partial including the contents of another.
Edit the main page,
content/index.html
, so it embeds the outer partial:Add these rules to
Rules
above the ones already present:Now generate the site with
nanoc compile
. When you view it you'll see the inner partial content nested inside the outer partial content, nested inside the main page, like this:A Brand New nanoc Site
This is the outer partial.
This is the inner partial.