When GreenHat refers to layouts, templates or includes, it is referring to a Smarty Template.
In the context of GreenHat, a layout is a file through which a page or post is rendered. You choose the layout for a page or post by specifying it in the page or post’s YAML front matter as follows:
This tells GreenHat to render the content through a layout called
post.tpl in the
Layouts can include bits of Smarty Templating logic that might be shared between a number of layouts. In the context of GreenHat these are called includes and they can be found in the
_layouts/includes folder (and the sub-folders under that).
Collectively all these sorts of files (the ones ending with a
.tpl suffix on the example site) are called templates. Smarty is a third party open source templating product maintained by New Digital Group. It’s a powerful templating system and GreenHat uses version 3 of the product. Full instructions can be found on the Smarty Templates site.
Smarty allows you to apply logic to the presentation layer. This goes against many programming paradigms that espouse separation but it’s necessary to make a static site generator reasonably user-friendly. Jekyll uses Liquid Templates in a similar manner.
GreenHat makes use of template inheritance in its templates. Most pages inherit their properties from the
default.tpl layout, which contains common headers, footers, menus and such.
This documentation will not be instructing you in the use of Smarty templates other than where it’s directly relevant to GreenHat.