The theme rendering process has several steps; knowing them is very useful if you want to fully understand all the possibilities the renderer can offer.
The Publii renderer can work in two modes:
- Single page mode
- Full page mode
The single page mode is used for creating a post page preview pulled from the post editor level.
Full page mode is used for creating a preview and during website synchronization.
We will focus here on the full page mode; the single page mode works in a very similar way but renders only a single post page.
- Theme is validated,
- Site config is loaded,
- Translations are loaded,
- Renderer loads website data from database,
- Theme config is loaded,
- Theme files are loaded,
- Publii Handlebars helpers are registered,
- Theme helpers from helpers.js (if exists) are registered,
- Content structure is loaded and cached,
- Common data for all views are loaded,
- Partials are registered (standard and custom ones),
- Frontpage and its pagination are rendered,
- Post pages are rendered,
- Tag pages and its pagination are rendered,
- Author pages and its pagination are rendered,
- Error page is rendered (if used),
- Search page is rendered (if used),
- CSS is created,
- Config files, assets and media files are copied to the output directory,
- RSS and JSON feed is rendered,
- Sitemap is created,
- AMP version is rendered.
You can use custom helpers and partials in your theme.
The theme CSS is a sum of three CSS sources:
main.css + visual-overrides.js output + custom CSS
So the output from the visual-overrides.js file overrides the main.css code, but any CSS code generated by Publii can be overridden with custom CSS code that is added in the Tools section of Publii.