In the node template, we want the node title to be output as follows:

  {{ title.prefix }}
  {% if not page %}
    <h2{{ title.attributes }}><a href="{{ url }}" rel="bookmark">{{ title.label }}</a></h2>
  {% endif %}
  {{ title.suffix }}

But changing the title prefix and suffix should be done globally, and will affect many other templates as well, thus this separate issue.

Comments

jenlampton’s picture

Title: Markup and variable cleanup for titles in all templates » Markup and variable cleanup for titles and attributes in all templates

This change also applies to attributes, content_attributes (should be content.attributes) and title_attributes (should be title.attributes)

star-szr’s picture

Priority: Major » Normal
Issue summary: View changes
Issue tags: +Twig

Changing to normal since there hasn't been much movement and we'd need to determine what would happen when {{ title }} is placed in the template. We talked about this on the Twig call and it seems like we'd need to introduce another theme function or template and we're trying to move away from very granular theme functions and templates.

mortendk’s picture

could we rename it {{ title.prefix }} & {{ title.suffix }} to something that makes sense ?
afaik it dosnt have anything to do with the title

rename:

{{ title.prefix }} -> {{ contextual_links }} 

{{ title.suffix }} -> {{ containerforstuff }}
lauriii’s picture

Version: 8.0.x-dev » 9.x-dev
Component: theme system » Classy theme
Status: Active » Postponed

This sounds a bit Classy issue. However this is something we can't do anymore for Drupal 8.

catch’s picture

Version: 9.x-dev » 8.3.x-dev
Status: Postponed » Active

Spoke to Cottser about this and it might be doable in a minor release with bc, so moving back down.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Berdir’s picture

Created #2943911: Figure out what to do with title prefix/title_suffix in entity templates, I think I outlined a plan there that could work in a minor release, input from frontend people very welcome. I think this could possibly be closed as a duplicate.

xmacinfo’s picture

I believe this is not a duplicate.

It's not only a question of {{ title.prefix }} and {{ title.suffix }}, but of also renaming some of the other title variables.For example, when a themer or a front-end want to display the title it may not make sense for him to output {title.label} in twig.

He or she may assume that the {title.label} variable will display “Title” and that {title} or {title.value} will display the correct title value.

The overall {title} twig context should be reviewed.

Berdir’s picture

There is no title.label, just label. And we are starting to deprecate that in #2923701: Mechanism to disable preprocessing of node base fields so they can be configured via the field UI where title will be like any other field, aka content.title.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

markconroy’s picture

Project: Drupal core » Classy
Version: 10.1.x-dev » 1.0.x-dev
Component: Classy theme » Code

Let's move this to Classy.