Templates

Thermite uses Tera for templating. If you've used Jinja2 or Nunjucks, you already know Tera.

Variables

Every template gets these variables:

Site-level (from thermite.toml)

VariableSource
site_titletitle
site_descriptiondescription
base_urlbase_url

Plus any [extra] keys, injected by name.

Page-level (from frontmatter + content)

VariableDescription
titlePage title
contentRendered HTML — use {{ content | safe }}
content_rawOriginal Markdown source
dateDisplay date (no time component)
date_rawOriginal date string from frontmatter
descriptionPage description
tagsTag array
urlPage URL path
og_imagePage or site-level OG image
og_type"article" for dated non-index, "website" otherwise
canonical_urlbase_url + url

Page list

VariableDescription
pagesArray of other pages (dated, non-index only)

Each entry: title, date, date_raw, url, description.

Note: pages only includes pages with a date that aren't index.md. Undated pages still build — they just don't appear in the list.


Example

A minimal base.html:

<!DOCTYPE html>
<html>
<head>
    <title>{{ "{% block title %}" }}{{ site_title }}{{ "{% endblock %}" }}</title>
</head>
<body>
    {{ "{% block content %}{% endblock %}" }}
</body>
</html>

A page.html extending it:

{{ "{% extends \"base.html\" %}" }}
{{ "{% block title %}" }}{{ "{{ title }}" }} — {{ "{{ site_title }}" }}{{ "{% endblock %}" }}
{{ "{% block content %}" }}
<h1>{{ "{{ title }}" }}</h1>
{{ "{{ content | safe }}" }}
{{ "{% endblock %}" }}

Markdown

Thermite uses pulldown-cmark with these extensions:

Standard Markdown (links, images, code blocks, blockquotes, lists) works as expected.