
By joelpittet on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.0.x
Description:
Summary
Branding variables (site_name
, slogan
, logo
) have been moved out of the page.html.twig
template and converted into a block called "Site Branding". @see #1053648: Convert site elements (site name, slogan, site logo) into blocks.
The original variables from the site settings are populating the block's variables and the block is easily moved through the Block UI now.
The upgrade will attempt to move the branding block into the header region or content region if it can't find the header region. If your site doesn't use these variables you can disable the block or the specific branding variables in the block UI.
Before in
page.html.twig
<header role="banner">
{% if logo %}
<a href="{{ front_page }}" title="{{ 'Home'|t }}" rel="home">
<img src="{{ logo }}" alt="{{ 'Home'|t }}"/>
</a>
{% endif %}
{% if site_name or site_slogan %}
<div class="name-and-slogan">
{# Use h1 when the content title is empty #}
{% if title %}
<strong class="site-name">
<a href="{{ front_page }}" title="{{ 'Home'|t }}" rel="home">{{ site_name }}</a>
</strong>
{% else %}
<h1 class="site-name">
<a href="{{ front_page }}" title="{{ 'Home'|t }}" rel="home">{{ site_name }}</a>
</h1>
{% endif %}
{% if site_slogan %}
<div class="site-slogan">{{ site_slogan }}</div>
{% endif %}
</div>{# ./name-and-slogan #}
{% endif %}
{{ page.header }}
</header>
After
page.html.twig
<header role="banner">
{{ page.header }}
</header>
block--system-branding-block.html.twig
{% extends "block.html.twig" %}
{% block content %}
{% if site_logo %}
<a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home">
<img src="{{ site_logo }}" alt="{{ 'Home'|t }}" />
</a>
{% endif %}
{% if site_name %}
<a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home">{{ site_name }}</a>
{% endif %}
{{ site_slogan }}
{% endblock %}
Impacts:
Site builders, administrators, editors
Themers