Problem/Motivation

Node label isn't present in the default subtheme's node.twig.
In a node view it makes sense, but I think it's illogical with node view modes.
As an example, if you make a view block and display a content view-mode (ie teaser) instead of fields, there wont be any title.

Steps to reproduce

This is the current code

<article{{ attributes.addClass(classes) }}>
  {{ title_prefix }}
  {{ title_suffix }}

  {% block content %}
    {{ content }}
  {% endblock %}
</article>

Proposed resolution

I propose to add this instead.

<article{{ attributes.addClass(classes) }}>
  {{ title_prefix }}
  {% if label and not page %}
    <h2{{ title_attributes }}>
      <a href="{{ url }}" rel="bookmark">{{ label }}</a>
    </h2>
  {% endif %}
  {{ title_suffix }}

  {% block content %}
    {{ content }}
  {% endblock %}
</article>

Comments

JFKiwad created an issue. See original summary.

ckng’s picture

Version: 5.0.0-alpha1 » 5.0.x-dev

The thing is why a node component is included in the subtheme kit, as an example? I say let's remove it since this creates extra work to maintain.

doxigo’s picture

Status: Active » Fixed

Nicely pointed out JF, and totally agree with removing the subtheme node.twig, we already have the parent theme for examples and such (we might as well add some more documentation on how things work). Currently, there's no point in having duplicate files.

I'll add a .gitkeep to the components folder and remove any child directory within

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

darkdim’s picture

Assigned: Unassigned » darkdim
darkdim’s picture

Issue tags: +Node Title, +title
darkdim’s picture

Assigned: darkdim » Unassigned