Quickstart

Render your first Kida template in 2 minutes

1 min read 249 words

Render your first Kida template in 2 minutes.

Prerequisites

  • Python 3.14+
  • Kida installed (pip install kida)

Step 1: Create a Template

Createtemplates/hello.html:

<!DOCTYPE html>
<html>
<head>
    <title>{{ title }}</title>
</head>
<body>
    <h1>Hello, {{ name }}!</h1>

    {% if items %}
    <ul>
        {% for item in items %}
        <li>{{ item }}</li>
        {% end %}
    </ul>
    {% end %}
</body>
</html>

Note: Kida uses unified{% end %}to close all blocks.

Step 2: Render the Template

Createrender.py:

from kida import Environment, FileSystemLoader

# Create environment with template directory
env = Environment(loader=FileSystemLoader("templates/"))

# Load and render the template
template = env.get_template("hello.html")
html = template.render(
    title="My Page",
    name="World",
    items=["Apple", "Banana", "Cherry"]
)

print(html)

Step 3: Run It

python render.py

Output:

<!DOCTYPE html>
<html>
<head>
    <title>My Page</title>
</head>
<body>
    <h1>Hello, World!</h1>

    <ul>
        <li>Apple</li>
        <li>Banana</li>
        <li>Cherry</li>
    </ul>
</body>
</html>

Key Concepts

Concept Syntax Example
Output {{ expr }} {{ name }}
Control {% tag %} {% if %},{% for %}
Block end {% end %} Closes any block
Comments {# text #} {# ignore me #}

Next Steps