Liquid tags & partials
Rendering partials, and the sandbox rules for tags.
Cartisto uses standard LiquidJS control-flow tags
({% if %}, {% for %}, {% case %}, {% assign %}, {% capture %}, {% comment %},
{% raw %}, …). Two things are Cartisto-specific: how partials resolve, and the
sandbox.
Partials with {% render %}
Reference partials by their full theme-relative path (no ./):
{% render 'views/components/header/header' %}
{% render 'views/components/product/card', product: item %}
{% render %}isolates scope — the partial only sees the data you pass, plus the page globals. Pass per-partial data explicitly (product: item).- The path is a key into the theme’s file set; it can’t traverse outside the
theme. A
{% render %}to a file that doesn’t exist is caught at save time, not at render time.
The sandbox
Templates render in a locked-down engine:
- No host access — you can’t reach
process, the filesystem, the database, or another tenant’s data. - Escape by default — output is HTML-escaped; opt out only with
| rawwhere the value is trusted (the platform tags,json_script, sanitized CMS HTML). - Prototype-chain access is blocked, and there are parse / render / memory limits so a pathological template can’t hang or OOM a worker.
Locked pages can’t be authored
views/pages/checkout.liquid and views/pages/order-confirmation.liquid are
rejected by the save API — the payment surface is platform-owned. See
Custom themes.
Tip
{% raw %} for literal braces
Documenting Liquid inside Liquid? Wrap it in {% raw %}…{% endraw %} so the
engine doesn’t try to evaluate the example.