Kida's template syntax for expressions, control flow, and composition.
Quick Reference
| Element | Syntax | Example |
|---|---|---|
| Output | {{ expr }} |
{{ user.name }} |
| Tags | {% tag %} |
{% if %},{% for %} |
| Block end | {% end %} |
Unified ending |
| Comments | {# text #} |
{# TODO #} |
| Filters | | filter |
{{ name \| upper }} |
| Pipeline | |> filter |
{{ x \|> a \|> b }} |
Syntax Guide
Variables
Output expressions and access patterns
{{ name }},{{ user.email }},{{ items[0] }}
Control Flow
Conditionals, loops, and pattern matching
{% if %},{% for %},{% match %}
Filters
Transform values in expressions
{{ name | upper }},{{ items | join(', ') }}
Functions
Define reusable template functions
{% def greet(name) %},{% macro %}
Inheritance
Extend and override base templates
{% extends %},{% block %}
Includes
Include partials and components
{% include %}, context passing
Caching
Block-level output caching
{% cache key %}...{% end %}
Async
Async iteration and await
async for,await, async templates
Key Features
- Unified
{% end %}— Clean, consistent block endings - Pattern matching —
{% match status %}{% case "active" %}...{% end %} - Pipeline operator —
{{ title |> escape |> upper |> truncate(50) }} - Built-in caching —
{% cache "sidebar" %}...{% end %}