Skip to content

Building with Wajha

What Wajha Does Not Support

Read this page before porting a theme from another platform. It is the shortest route to understanding what Wajha actually is.

Wajha is Jinja-style, not Jinja-compatible

Wajha's syntax comes from the Django/Jinja family, and we describe it as Jinja-style with a published tag and filter set. We do not claim compatibility, because a theme written for a Python Jinja2 environment — or for another platform's Jinja dialect — will not run here unmodified.

The differences that catch people:

ThingJinjaWajha
Filter argumentsvalue | truncate(160)value|truncatechars:160 — a colon, not brackets
Loop variablesloop.index, loop.firstforloop.Counter, forloop.First — capitalised
Empty loop{% for %}…{% else %}{% for %}…{% empty %}
Parent block{{ super() }}{{ block.Super }} — capital S (see below)
Your theme's strings{{ _('key') }} or a filterData: {{ t.section.key }}
Datesstrftime-style %Y-%m-%dPlanned: named formats — see below
String formattingPython %s / {}Not available; use filters
Line statements (# for)Optional in Jinja2Not supported
Whitespace control{%- … -%} and {{- … -}}The same — both work

{{ block.super }} in lowercase does not fail. It renders an empty string, silently, and the parent block's content vanishes from the page. Of everything on this list it is the one most likely to cost you an afternoon.

Not supported, deliberately

Arbitrary code

There is no {% python %}, no eval, no way to define a function. A template describes markup; logic belongs in the settings schema or in the data the route provides.

Filesystem and network access

No {% ssi %}, no reading files, no HTTP calls. {% include %} and {% extends %} resolve only within your own theme, and a path containing .. or a leading / fails to compile.

Disabling output escaping

Every value you print is HTML-escaped, and there is no opt-out. These are refused when your theme is loaded, with the file and line:

BannedWhy
|safe, {% autoescape %}They switch escaping off
{% filter %}It applies filters to a whole block — another route to safe
|truncatechars_html, |truncatewords_htmlThey return their input as unescaped HTML
|urlize, |urlizetruncThey generate markup, with an option to skip escaping

The two _html truncation filters are the surprising ones: they look like text helpers, and a product description passed through either would render raw. Use truncatechars and truncatewords, which escape.

Merchant-authored rich text — a page body written in an editor — will be printed through a rich filter that runs a server-side allowlist sanitiser. It arrives with the slice that introduces rich-text content, and until then nothing in the context is rich text.

Generators and unbounded loops

There is no range(), and the {% lorem %} text generator is banned, as is {% now %} — page timestamps come from the data. Every collection you can loop over is a bounded list the route placed in the context. This is a deliberate limit on how much work one template can ask for.

Arithmetic, on the other hand, is available: {{ a + b }}, {{ a / b }}. That includes dividing a price, which is exactly why every amount arrives pre-formatted — see Money, Dates & Numerals.

Merchant-authored HTML or JavaScript in settings

A merchant cannot type markup into a Theme Editor field and have it rendered. Settings are typed — text, number, colour, URL, image, select — and typed values are escaped on output. A "custom HTML" setting is the classic store-builder XSS hole, and on a storefront it would execute beside a shopper's payment details.

Things that are coming

These are not supported yet and are on the roadmap rather than ruled out:

  • Custom filters defined by a theme.
  • Server-rendered cart and checkout templates (today those are platform-rendered, with hooks for your styling).
  • Theme-defined page templates beyond the fixed route set.

If you are porting

Work in this order:

  1. Change filter arguments from f(x) to f:x.
  2. Replace loop.* with forloop.* and capitalise the field names; {% else %} on a loop becomes {% empty %}; super() becomes {{ block.Super }}.
  3. Move your strings into locales/ar.json and locales/en.json and read them as t.….
  4. Remove every |safe and every _html filter. If output looks wrong afterwards, the value was meant to be text.
  5. Replace any price arithmetic with the formatted field — see Money, Dates & Numerals.
  6. Replace physical CSS properties with logical ones — see RTL & Arabic.
  7. Load the theme. Anything banned, any unresolvable include and any syntax error is reported with its file and line, and the theme is refused until it is fixed.