Templates and themes

Setting up page layout is controlled by Mako templates. Mako is well documented elsewhere, the following deals with Pagegen specifics.

Pages may specify a template by setting Template header.


All templates are located in themes/<theme name>/templates directory. Set site theme in site.conf using theme=<theme name>.

Theme directory structure:

├── assets/
└── templates/

On generation the assets directory and its sub directories are copied verbatim to site/<environment>/assets/theme. This is where all theme assets (javascript, css, images etc) for the theme are located.

The templates directory contains the theme mako templates, it must contain pages.mako, and may contain whatever other templates are required to render the site. In addition it may contain default templates, see below.

Default templates

Templates may be created to as needed, but there must be at least one called pages.mako. The following templates will be used in specific circumstances, if they exist in the themes/<theme name>/templates directory.

Name Purpose
author.mako Author profile template
authors.mako Listing of authors
directories.mako Used if no index file defined in directory
pages.mako Mandatory, default template
tag.mako Listing the pages for a given tag
tags.mako Listing the tags defined in page headers

Template variables

The following context/variables are available to the templates.

Name Description
page Page object
site Site object
year yyyy
month mm
day dd