Learning path

Full curriculum

Full curriculum

Arrows go from each prerequisite to the units that depend on it. Hover or focus a unit to highlight its path.

Unit content

Server-side HTML templating

A server-side HTML template combines a document structure with application data to produce HTML before the response is sent to the browser.

For example, a template may contain

<h1>{{ title }}</h1>

and render it using the current page title supplied by the server.

Data and presentation

Handlers or application services prepare the data needed by a view. Templates should primarily express presentation rather than become a second home for business rules.

Escaping

Values inserted into HTML can contain characters with syntactic meaning. Template systems should escape untrusted text for the output context by default; bypassing escaping requires deliberate justification.

Layouts and reusable fragments

Shared layouts avoid repeating page structure, while partial templates can represent reusable components such as rows, forms or navigation.

A server does not always need to render a complete document. It can render only the fragment required by a request and let the client place that HTML into an existing page.

Server-side templating therefore connects application state to HTML while keeping document generation on the server.