Templates & Tags

Tera tags — static, link, media, messages, form.xxx.

● ● ●
{# Files in static/ #}
<link rel="stylesheet" href="{% static "css/style.css" %}">
<script src="{% static "js/app.js" %}"></script>

{# Files in media/ (user uploads) #}
<img src="{% media article.image %}" alt="...">
<form method="POST">
    {# CSRF automatic — included in every Runique form render #}
    {% form.my_form %}
    ...
</form>

{# CSP nonce — for authorised inline scripts #}
<script nonce="{{ csp_nonce }}">
    console.log(''authorised by CSP'');
</script>
{# In the template — Runique tag #}
{% messages %}

{# In the Rust handler #}
success!(request.notices => "Saved!");
error!(request.notices   => "Error.");
info!(request.notices    => "Info.");
warning!(request.notices => "Warning.");
{# base.html — parent template #}
<html>
<body>
    {% block content %}{% endblock %}
</body>
</html>

{# page.html — child template #}
{% extends "base.html" %}
{% block content %}
    <h1>My content</h1>
{% endblock %}