Summary
The system branding block now provides the site logo as a renderable element
through the new site_logo_element variable.
The existing site_logo variable is retained for backwards
compatibility but is deprecated in Drupal 12.1.0 and will be removed in
Drupal 13.0.0.
What's changing
Previously, the system branding block template constructed the logo image
directly from the site_logo URI.
{% if site_logo %} <a href="{{ path('<front>') }}" rel="home"> <img src="{{ site_logo }}" alt="{{ 'Home'|t }}" fetchpriority="high" /> </a> {% endif %}
The system branding block now provides a rendered logo element through
site_logo_element.
{% if site_logo_element %} <a href="{{ path('<front>') }}" rel="home"> {{ site_logo_element }} </a> {% endif %}
For supported raster image formats, the rendered image includes its
intrinsic width and height attributes.
SVG logos are rendered inline.
Theme developer impact
Themes that override
block--system-branding-block.html.twig should update their
templates to use site_logo_element.
For example, change:
{% if site_logo %} <a href="{{ path('<front>') }}" rel="home"> <img src="{{ site_logo }}" alt="{{ 'Home'|t }}" fetchpriority="high" /> </a> {% endif %}
to:
{% if site_logo_element %} <a href="{{ path('<front>') }}" rel="home"> {{ site_logo_element }} </a> {% endif %}
Using site_logo_element allows Drupal to provide the
appropriate logo markup, including intrinsic image dimensions and inline
rendering for SVG logos.
Deprecation
The site_logo variable remains available for backwards
compatibility but is deprecated in Drupal 12.1.0 and will be removed in
Drupal 13.0.0.
Theme developers should migrate custom system branding block templates
to site_logo_element.