pyssgA tiny-kernel, plugin-driven static site generator

Templating

The Template plugin renders pages with Jinja2, and adds two Hugo-inspired conveniences on top of it.

  • Inheritance - share a base skeleton with {% extends %} and {% block %}.
  • Partials - reuse snippets and components with the partial() function.
  • Lookup cascade - let pages resolve their template automatically by type, section and kind, instead of declaring layout everywhere.

Everything here lives in the Template plugin and standard Jinja2 - the kernel is untouched. This very site uses all three features; its layouts/ folder is a working reference.

The template context

Every template receives:

VariableWhat it is
contentThe rendered HTML body (safe markup).
pageThe page's frontmatter merged with its meta (url, prev, ...).
siteSite-wide options from Config.options.
collectionsNamed groups of pages (when Collections is used).
menusNamed navigation trees (when Navigation is used).
partialThe partial render function.