Using templates
Templates are what website-generator uses when generating HTML. They define the base HTML that renders across all pages, as well as HTML for sections and pages. Templates have access to variables that contain data about the current page, section and website, as well as runtime data such as the date.
Templates are written in the Handlebars language and
are loaded from the templates directory.
All templates have access to a content variable that contains the contents of
a Markdown file or nested template. When rendering content in a template, use
the content variable in a
triple-stash to
render the output as non-escaped HTML:
Types of templates
There are four types of templates that website-generator recognises:
The template lookup
website-generator performs a check to see which template should be loaded for a
Using variables
Templates have access to a range of variables at runtime. These variables can be
Custom helpers
website-generator includes some of its own helpers in addition to the [built-in