Templating
Rubedo uses the Tera template engine. You can refer to its documentation for how to actually use it to create your own theme.
Tera Context
Inside your templates you can use the site
and page
variables, provided by the context. Here's a rundown of what they contain.
site
: Represents the entire website, and is always available in the context.config
: Represents theconfig.toml
file of the website. The description for the various sub-keys can be found in the configuration docspages
: List of pages available in your website, each corresponding to a markdown file (indified by the.md
file extension) inside thecontent
directory. Each page contains the same data detailed in thepage
definition below.
page
: Represents the current page being rendered. For obvious reasons, this is only available when rendering a page inside thecontent
directory.title
: Title of the page, as specified in the frontmatter. This defaults to the file name.content
: String containing the raw content of the markdown file.html
: Rendered HTML generated from the markdown file. When displaying it inside a Tera template, it might be a good idea to use thesafe
filter like so:{{ page.html | safe }}
. Rubedo uses Comrak for rendering markdown.url
: Absolute URL of the page, prefixed withsite.config.base_url
if provided in the config.template
: Template file path (relative to the theme directory) to use for the page. Defaults to__page__.html
.weight
: Weight of the page, for sorting purposes. Lower weight pages come before higher weight ones. Pages without a weight are always sorted after pages with a weight. Pages without a weight are sorted on their own by theirurl
value.datetime
: Publish date of the page, parsed from the frontmatter.relative_path
: The path to the page, relative to thecontent
directory, with the file extension from the template file used.relative_path_no_ext
: The path to the markdown file, relative to the content directory, minus the file extension.extension
: Generated page file extension, with leading dot.skip
: Boolean, if true, rendering of this page will be skipped. It will still be available in the context as an item insidesite.pages
.metadata
: Contains the values parsed from the frontmatter.