Templates

Tera filters & functions

Asset filters

FilterDescriptionExample
staticApp static URL prefix{{ "css/main.css" | static }}
mediaApp media URL prefix{{ "photo.jpg" | media }}

Markdown filter

FilterDescriptionExample
markdownConverts Markdown to HTML (automatically safe){{ page.content | markdown }}

Runique's preprocessor automatically injects \| safe — no need to add it manually.


Form filter

FilterDescriptionExample
formFull form rendering{{ form.my_form | form | safe }}
form(field='xxx')Single field rendering{{ form.my_form | form(field='email') | safe }}
csrf_fieldGenerates a hidden CSRF input{{ csrf_token | csrf_field | safe }}

Tera functions

FunctionDescriptionExample
csrf()Generates a CSRF field from context{{ csrf() }}
nonce()Returns the CSP nonce{{ nonce() }}
link(link='...')Named URL resolution{{ link(link='index') }}