Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge items in nanoc

I have been trying to use nanoc for generating a static website. I need to organize a complex arrangement pages I want to keep my content DRY.

How does the concept of includes or merges work within the nanoc system? I have read the docs but I can't seem to find what I want.

For example: how can I take two partial content items and merge them together into a new content item.

In staticmatic you can do some like the following inside your page.

= partial('partials/shared/navigation')

How would a similar convention work within nanoc?

like image 518
Gordon Potter Avatar asked Apr 09 '10 23:04

Gordon Potter


1 Answers

nanoc’s author here.

In nanoc, partials are layouts. So, you could have layouts/partials/shared/navigation.html and then render that partial like this:

= render '/partials/shared/navigation'

For that to work, enable the Rendering helper first, by including it somewhere in the lib/ dir (e.g. lib/helpers.rb):

include Nanoc3::Helpers::Rendering

For more information, check out the layouts as partials section of the manual.

Hope this helps!

like image 153
Denis Defreyne Avatar answered Nov 14 '22 22:11

Denis Defreyne