5

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?

Jack Chu
  • 6,791
  • 4
  • 38
  • 44
Gordon Potter
  • 5,802
  • 9
  • 42
  • 60

1 Answers1

16

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!

Community
  • 1
  • 1
Denis Defreyne
  • 2,213
  • 15
  • 18