1. 8.5.x core/themes/stable/templates/content/taxonomy-term.html.twig
  2. 8.5.x core/modules/taxonomy/templates/taxonomy-term.html.twig
  3. 8.5.x core/themes/classy/templates/content/taxonomy-term.html.twig
  4. 8.0.x core/modules/taxonomy/templates/taxonomy-term.html.twig
  5. 8.0.x core/themes/stable/templates/content/taxonomy-term.html.twig
  6. 8.0.x core/themes/classy/templates/content/taxonomy-term.html.twig
  7. 8.1.x core/themes/classy/templates/content/taxonomy-term.html.twig
  8. 8.1.x core/modules/taxonomy/templates/taxonomy-term.html.twig
  9. 8.1.x core/themes/stable/templates/content/taxonomy-term.html.twig
  10. 8.2.x core/themes/classy/templates/content/taxonomy-term.html.twig
  11. 8.2.x core/modules/taxonomy/templates/taxonomy-term.html.twig
  12. 8.2.x core/themes/stable/templates/content/taxonomy-term.html.twig
  13. 8.3.x core/themes/classy/templates/content/taxonomy-term.html.twig
  14. 8.3.x core/modules/taxonomy/templates/taxonomy-term.html.twig
  15. 8.3.x core/themes/stable/templates/content/taxonomy-term.html.twig
  16. 8.4.x core/modules/taxonomy/templates/taxonomy-term.html.twig
  17. 8.4.x core/themes/stable/templates/content/taxonomy-term.html.twig
  18. 8.4.x core/themes/classy/templates/content/taxonomy-term.html.twig
  19. 8.6.x core/themes/stable/templates/content/taxonomy-term.html.twig
  20. 8.6.x core/modules/taxonomy/templates/taxonomy-term.html.twig
  21. 8.6.x core/themes/classy/templates/content/taxonomy-term.html.twig

Default theme implementation to display a taxonomy term.

Available variables:

  • url: URL of the current term.
  • name: Name of the current term.
  • content: Items for the content of the term (fields and description). Use 'content' to print them all, or print a subset such as 'content.description'. Use the following code to exclude the printing of a given child element:

  {{ content|without('description') }}
  
  • attributes: HTML attributes for the wrapper.
  • page: Flag for the full page state.
  • term: The taxonomy term entity, including:
    • id: The ID of the taxonomy term.
    • bundle: Machine name of the current vocabulary.
  • view_mode: View mode, e.g. 'full', 'teaser', etc.

See also

template_preprocess_taxonomy_term()

File

core/modules/taxonomy/templates/taxonomy-term.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display a taxonomy term.
  5. *
  6. * Available variables:
  7. * - url: URL of the current term.
  8. * - name: Name of the current term.
  9. * - content: Items for the content of the term (fields and description).
  10. * Use 'content' to print them all, or print a subset such as
  11. * 'content.description'. Use the following code to exclude the
  12. * printing of a given child element:
  13. * @code
  14. * {{ content|without('description') }}
  15. * @endcode
  16. * - attributes: HTML attributes for the wrapper.
  17. * - page: Flag for the full page state.
  18. * - term: The taxonomy term entity, including:
  19. * - id: The ID of the taxonomy term.
  20. * - bundle: Machine name of the current vocabulary.
  21. * - view_mode: View mode, e.g. 'full', 'teaser', etc.
  22. *
  23. * @see template_preprocess_taxonomy_term()
  24. *
  25. * @ingroup themeable
  26. */
  27. #}
  28. <div{{ attributes }}>
  29. {{ title_prefix }}
  30. {% if not page %}
  31. <h2><a href="{{ url }}">{{ name }}</a></h2>
  32. {% endif %}
  33. {{ title_suffix }}
  34. {{ content }}
  35. </div>

Related topics

Comments

eloiv’s picture

Taxonomy vocabulary template. Is not the best solution, but is work.

use \Drupal\taxonomy\Entity\Term;

function bs_base_theme_theme_suggestions_page_alter(array &$suggestions, array $variables) {
   $tid = \Drupal::routeMatch()->getRawParameter('taxonomy_term');
   $term = Term::load($tid);
   if (!empty($term)) {
     $vid = $term->vid->getValue();
     $suggestions[] = 'page__taxonomy__vocabulary__' . $vid[0]['target_id'];
   }
}