0

I have group of pages on site that is statically generated using nanoc; each group represents one document kind and has it's own template. Each group template is a little different. For example, main template:

<html>
<body>
    <--header-->
    <--news-->
    <--content-->
    <--sidebar-->
</body>
</html>

And then some other template maybe will not have news section, but will have the footer:

<html>
<body>
    <--header-->
    <--content-->
    <--sidebar-->
    <--footer-->
</body>
</html>

and so on. What would be better thing to do:

[A] to have one master template and then to have a flag to turn on/off certain imports

or

[B] to have many smaller templates that include common chunks of html?

igr
  • 10,199
  • 13
  • 65
  • 111

1 Answers1

1

I have a relatively large site on nanoc, and I do [B], mostly. I have a fairly complex nested hierarchy of layouts. Article pages are something like this (not these actual tags, I'm just using pseudo-xml to indicate how the layouts are nested):

<default>
  <content>
    <article>
      <post> <!-- or image, or link, or quote, or ... -->
        <%= yield %>
      </post>
    </article>
  </content>
</default>

While a tag or archive page would be:

<default>
  <content>
    <list>
      <%= yield %>
    </list>
  </content>
</default>

Every page on my site uses the default layout. Most pages use content, with the exception of a few pages that are "chromeless"… Everything else is some combination of these or other layouts. I think I've got about 25 layouts in total :)

bobthecow
  • 5,047
  • 25
  • 27