Skip to main content
Theme templates are plain Twig. The application renders @theme/templates/index.twig for the landing page and hands it a set of globals; how you organize everything below that is up to you.

The layout

A layout owns the HTML shell and declares the blocks pages fill in:
layouts/theme.twig
The Vite client tag is what makes hot reloading work, and it only appears while THEME_ASSETS_SERVER is set.

Pages

templates/index.twig
Everything resolves through @theme, which points at the active theme’s directory.

Sections and snippets

Sections are page-sized blocks. Snippets are fragments you pass data to:
sections/pricing.twig
Dynamic includes work too, which is handy for icon sets or per-feature blocks:

Strict variables

In debug mode Twig runs with strict variables: reading something undefined raises an error instead of rendering nothing. Most globals are conditional, so guard them.
Test with debug mode on. A template that only breaks in production is usually a missing is defined.

Honoring admin settings

The point of a theme is that it stays configurable. Read the settings administrators expect to control:

Translating

Theme strings belong to the theme domain:
A plain __() resolves against the application’s catalog, not yours. See Theme localization.

Markdown and formatting

Twig’s Intl and Markdown extensions are available, which is useful for settings that hold rich text:

Caching

Template caching is on when CACHE=true and DEBUG=false. During development keep caching off, and after deploying a template change on a cached installation, clear the cache from Status → Clear cache.