ombryt

Reference

Filters and functions

All of MiniJinja's built-in filters are there (length, join, default, replace, urlencode, tojson, sort, …). ombryt adds these.

Filters #

Filter
mdmarkdown to HTML: {{ intro | md }}
md_inlinethe same, without the surrounding <p>
date(format)formats a date, see below
url(absolute=false)a site path with the site's base path; url(true) adds the origin
slugify"Hello, World" → hello-world
plaintextthe text of HTML, tags removed
one_linewhitespace collapsed to single spaces
truncate_words(n, end="…")the first n words
xml_escapefor hand-written XML
dumpthe same as tojson, for templates from Nunjucks

Date formats #

date takes a name or a strftime pattern:

FormatGives
DATE (the default)2023-09-21
HUMAN_DATESeptember 21, 2023
DATETIME2023-09-21 10:00
ISO, RFC33392023-09-21T10:00:00Z
RFC2822Thu, 21 Sep 2023 10:00:00 +0000
YEAR2023
"%d %b %Y"21 Sep 2023

Dates are in UTC.

Functions and globals #

Name
now()the time of the build, in RFC 3339
site[site] from ombryt.toml, plus site.generator
search.pages(query, sort, limit)pages matching query, sorted, at most limit (0: all)
search.page(query, sort)the first of them
search.next(url, query, sort)the page after url in that list
search.previous(url, query, sort)the page before it
search.values(key, query, exclude)distinct values of key, with counts: [{name, count}]
search.tags(query, exclude)the same for tags

sort defaults to date=desc. See Queries.