← Back to the glossary

Web design · Development · SEO

Template

Website templates explained: separating structure and presentation

Editorially reviewed ·

Clear definition

A template is a reusable pattern that defines how structured content is rendered. It can contain HTML structure, component slots, and dynamic variables. Content management systems often use separate templates for pages, posts, categories, or individual content modules.

The terms template, theme, and layout vary between systems. A theme usually represents a broader design package, while a template refers to a specific rendering pattern. Good templates produce semantic HTML, support responsive and accessible interfaces, perform efficiently, and remain maintainable independently of individual content. A custom template is not automatically better; code quality, flexibility, and long-term maintenance matter.

Template in practice

Templates should connect content and presentation without embedding editorial data directly in code. Reusable partials reduce duplication but need defined inputs and robust empty states.

A suitable content management system reflects content types, roles, approvals, multilingual needs, and integrations. The number of available extensions is not a quality measure by itself. A clear editorial workflow, maintained components, defined ownership, and an update strategy matter more. Typical tasks should be tested with real content before a decision is made rather than comparing feature lists alone.

Template: relevance to SEO, paid search, and GEO

A CMS supports visibility when editors can control page titles, descriptions, headings, internal links, structured data, and redirects. Campaign landing pages should be quick to create without bypassing quality controls. Templates need useful guardrails: sound semantics, defined image sizes, and required fields are more valuable than unlimited freedom that permits new errors on every page.

For search and answer systems, coverage of Template should distinguish its definition, scope, and evaluation criteria. The editorial reference is “The template element” by WHATWG, making central claims traceable for readers and machine-based systems.

Practical code example

PHP

Output data safely in a PHP template

Dynamic values are escaped for the HTML context. The template contains presentation rather than database access.

<article class="glossary-card">
  <h2><?= htmlspecialchars($entry['nameDE'], ENT_QUOTES, 'UTF-8') ?></h2>
  <p><?= htmlspecialchars($entry['descriptionDE'], ENT_QUOTES, 'UTF-8') ?></p>
  <a href="/de/glossar/<?= rawurlencode($entry['url']) ?>/">
    Begriff öffnen
  </a>
</article>

Sources and further reading

  1. Standard The template element WHATWG · Checked

Frequently asked questions

A template is a reusable pattern that defines the structure and output of dynamic or editorial content.

A template usually describes one rendering pattern, while a theme can be a broader design system containing multiple templates and styles.