Skip to content

Building with Wajha

Tags Reference

Every tag a theme can use, and every one it cannot. Like the filters reference, everything here was checked against the engine.

Structure

TagWhat it does
{% extends 'layout.jinja' %}Makes this template fill another's blocks. Must come first.
{% block name %}…{% endblock %}A region a child template can replace. {{ block.Super }} inside it renders the parent's version.
{% include 'partials/x.jinja' %}Renders another template here, with the current data.
{% import 'm.jinja' name %}Brings a macro from another template into this one.
{% macro card(p) %}…{% endmacro %}A reusable piece of markup that takes arguments.
{% comment %}…{% endcomment %}A block that is never rendered. {# … #} for a single line.

Every template name resolves from your theme's templates/ directory, wherever the tag is written. A name with .., a leading / or a backslash is refused when the theme is loaded.

Logic

TagWhat it does
{% if … %}…{% elif … %}…{% else %}…{% endif %}Conditionals. and, or, not, in, comparisons.
{% for x in xs %}…{% empty %}…{% endfor %}Loops, with forloop.Counter, forloop.First, forloop.Last and the rest.
{% ifchanged x %}…{% endifchanged %}Renders only when x differs from the previous iteration.
{% ifequal a b %} / {% ifnotequal a b %}Older spellings of {% if a == b %}.
{% with n=xs|length %}…{% endwith %}Names a value for the enclosed block.
{% set n = 3 %}Names a value until the end of the block.
{% firstof a b "fallback" %}Prints the first value that is not empty.
{% cycle "odd" "even" %}Alternates between values on each loop pass.

Output

TagWhat it does
{% spaceless %}…{% endspaceless %}Removes whitespace between tags.
{% templatetag openblock %}Prints a literal {% — for documentation inside a theme.
{% widthratio value max width %}Scales a number to a width. Not for money.

Refused

TagWhy
{% autoescape %}It can switch escaping off
{% filter %}It applies filters to a whole block — another route to safe
{% ssi %}Templates include templates with {% include %}
{% lorem %}It generates unbounded text
{% now %}Output that changes by the second cannot be cached or tested; dates come from the data

Platform

TagWhat it does
{% wajha_head %}Writes the canonical URL, language alternates, Open Graph tags and structured data — or noindex on a missing page. Belongs inside <head>.
{% wajha_body %}Where the storefront script will go. Belongs just before </body>.

Both must appear in layout.jinja, take no arguments, and write markup the platform built — you choose where it goes, not what it says. See Theme Development.