By seantwalsh on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
As part of an initiative to clean up the markup in core, the following changes have been made to node.html.twig.
Summary
- Removed
id="node-#"from<article> - Updated user_picture variable to author_picture
- Added author attributes for RDF
- Made CSS follow the Layout rules in CSS architecture (for Drupal 8) - Separate Concerns
- Added classes in attributes.class:
- .node
- .node--$nodetype
- .node--promoted
- .node--sticky
- .node--unpublished
- .node--preview
- Removed submitted variable and replace with author_name and date variables
- Updated CSS for Bartik to match new classes
Default node template - core/modules/node/templates/node.html.twig
Before
<article id="node-{{ node.id }}" class="{{ attributes.class }} clearfix"{{ attributes|without('id', 'class') }}>
{{ title_prefix }}
{% if not page %}
<h2{{ title_attributes }}>
<a href="{{ node_url }}" rel="bookmark">{{ label }}</a>
</h2>
{% endif %}
{{ title_suffix }}
{% if display_submitted %}
<footer>
{{ user_picture }}
<p class="submitted">{{ submitted }}</p>
</footer>
{% endif %}
<div{{ content_attributes }}>
{{ content|without('links') }}
</div>
{{ content.links }}
</article>
After
<article{{ attributes }}>
{{ title_prefix }}
{% if not page %}
<h2{{ title_attributes }}>
<a href="{{ url }}" rel="bookmark">{{ label }}</a>
</h2>
{% endif %}
{{ title_suffix }}
{% if display_submitted %}
<footer class="node__meta">
{{ author_picture }}
<div class="node__submitted {{ author_attributes.class }}"{{ author_attributes|without('class') }}>
{% trans %}Submitted by {{ author_name|passthrough }} on {{ date }}{% endtrans %}
{{ metadata }}
</div>
</footer>
{% endif %}
<div class="node__content {{ content_attributes.class }}"{{ content_attributes|without('class') }}>
{{ content|without('links') }}
</div>
{% if content.links %}
<div class="node__links">
{{ content.links }}
</div>
{% endif %}
</article>
Impacts:
Themers