Skip to main content

Twig namespaces

{% extends '@theme:base/components/announcement.html.twig' %}

{% block title_outer %}
<h2>{{ block('title') }}</h2>
{% endblock %}

The selected theme will always be the main namespace for Twig, i.e. pages/demo.html.twig will be loaded from the selected theme's templates.

If a theme has a parent theme, then the parent theme will also be within the main namespace.

Twig templates of a particular theme can be referenced using the theme namespace.

note

This is particularly useful when extending a base theme.