🌐Template Engine
Also known as Template, HTML Template, Templating
A tool that fills blanks in a page with real data to make HTML.
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.
Example
Emma's shop has one product template. The engine fills it with each product's name and price to make 500 pages.
Why it matters
Templates keep page layout and data apart. One template can make thousands of pages.
Definition
Example code
jinja
<h1>Hi {{ name }}</h1>
<!-- with name = "Emma" this becomes: <h1>Hi Emma</h1> -->Common mistake
Key takeaways
- 1Blanks and data. Markers become real values.
- 2Loops and checks. Lists and optional parts.
- 3Escape by default. Keeps user text safe.