Template content question

Question about best practice - performance-wise and DRY concerns - about setting up page templates.

I have a single.html in my layouts/_defaultfolder that pretty much works for everything on my site. However, I do have some content types that use a different set of layouts and styles for which I’m wondering which is the best approach: (Note that article head/foot - not to be confused with site header and footer - are the same in all situations, and only the content would differ)

  1. Use the same layouts/_default/single.html file and determine which content partial to use via if eq .Type "type"/else statements
  2. Set up separate single.html templates in each of the content type layout/ folders, and pull in the universal article head/foot via partials or template blocks (or other, if I’m missing something else)

I vote for #2, sacrificing some potential duplication in return for simplicity. Debugging is much simpler when they’re separated.

1 Like