# Template Engine

> A tool that fills blanks in a page with real data to make HTML.

**Field:** Software Development  
**Category:** Web Development  
**Also known as:** Template, HTML Template, Templating

## Think of it like

Think of it like a birthday card with a blank for the name. You fill in a new name for each friend.

## Definition

A template engine fills in blanks in a page with real data to make HTML. You write the page once with markers, like {{ name }}, where the data should go. When a request comes in, the engine swaps each marker for a value. Templates can also loop over lists and show parts only when a rule is true. They are common in server frameworks and static site tools.

## Example

Emma's shop has one product template. The engine fills it with each product's name and price to make 500 pages.

## Example code

```jinja
<h1>Hi {{ name }}</h1>
<!-- with name = "Emma" this becomes: <h1>Hi Emma</h1> -->
```

The marker is swapped for the real name.

## Why it matters

Templates keep page layout and data apart. One template can make thousands of pages.

## Common mistake

Turning off the engine's escaping to show raw HTML from users. It lets attackers put scripts on your page.

## Three principles

- **Blanks and data.** Markers become real values.
- **Loops and checks.** Lists and optional parts.
- **Escape by default.** Keeps user text safe.

## Related terms

- [HyperText Markup Language (HTML)](https://learn.benibix.com/term/development/html)
- [Server-Side Rendering (SSR)](https://learn.benibix.com/term/development/server-side-rendering)
- [Static Site Generation (SSG)](https://learn.benibix.com/term/development/static-site-generation)
- [Django](https://learn.benibix.com/term/development/django)
- [Content Management System (CMS)](https://learn.benibix.com/term/development/content-management-system)

---

Source: https://learn.benibix.com/term/development/template
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
