The Twig template for node.html.twig (and other templates) added default classes to these. We should do the same for taxonomy templates.

Suggestions include
.taxonomy-term
.taxonomy-term--vocabulary-name
.taxonomy-term--view-mode
.taxonomy-term--vocabulary-name--view-mode

Classes for taxonomy-term.html.twig

Patch will be added to the comments.

Comments

markconroy created an issue. See original summary.

markconroy’s picture

Adding patch, setting status to 'needs review'.

markconroy’s picture

Status: Active » Needs review
markconroy’s picture

Issue summary: View changes
FileSize
69.38 KB
joelpittet’s picture

We tried hard to lighten the load of classes that are unneeded but give the flexibility to the frontend dev to add them back if they want to use them.

I don't think we should add them in, I do think you should if you want/need them for your project.

Maybe we can find a place to improve docs or make this easier for site builders?

Jeff Burnz’s picture

Patches that add classes should really be against Classy, not templates in core modules etc (or Stable).

Note that Classy adds two classes already:

{%
  set classes = [
    'taxonomy-term',
    'vocabulary-' ~ term.bundle|clean_class,
  ]
%}
dawehner’s picture

Maybe we can find a place to improve docs or make this easier for site builders?

Just a random idea, maybe having a test theme which has all kind of custom CSS classes, some using variables for example, might be a good place to give ideas for people?

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

lauriii’s picture

Status: Needs review » Needs work

I have proposed adding unstable classy here: #2659890: Discuss how markup changes should be handled in Seven and Bartik which could include a unlimited amount of class changes, just like Bartik and Seven. It seems like it would help this issue.

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

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should 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.