Bengal uses Jinja2 for all templates. If you know Python, you'll feel at home.
Template Lookup Order
flowchart LR
A[Page Request] --> B{templates/ ?}
B -->|Found| C[Use Your Template]
B -->|Not Found| D{Theme templates/ ?}
D -->|Found| E[Use Theme Template]
D -->|Not Found| F[Use Bengal Default]
Bengal searches: Your project → Theme → Bengal defaults
Quick Start
1 2 3 4 5 6 7 8 9 | |
1 2 3 4 5 6 7 8 9 10 11 12 | |
1 2 3 4 5 6 7 8 | |
Key Concepts
| Concept | Syntax | Purpose |
|---|---|---|
| Extends | {% extends "base.html" %} |
Inherit from parent template |
| Block | {% block name %}...{% endblock %} |
Replaceable section |
| Include | {% include "partial.html" %} |
Insert another template |
| Variable | {{ page.title }} |
Output a value |
| Filter | {{ text \| truncate(100) }} |
Transform a value |
Template Inheritance
flowchart TB
A["baseof.html<br/>(blocks: head, content, footer)"]
B["single.html<br/>(extends baseof)"]
C["list.html<br/>(extends baseof)"]
D["doc.html<br/>(extends single)"]
A --> B
A --> C
B --> D
Tip
Override sparingly: You only need to create templates you want to customize. Start by copying one template from your theme, modify it, and let the rest fall through to defaults.
In This Section
Template Functions Reference
Complete reference for Bengal's template filters and functions