Taxonomy breadcrumbs (using Crumbs)
You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules
Crumbs can be used to create taxonomy-based breadcrumbs.
The plugins for that are already built-in.
You can enable them on Admin > Structure > Crumbs (admin/structure/crumbs).
Prerequisites:
- Taxonomy module enabled on your site.
- Some vocabularies existing on your site.
For the examples below, we assume having a vocabulary named "animal_categories" and another vocabulary named "tags". - Some node types with "term reference" fields.
For the examples below, we assume having a field named "field_animal_category" (on "animal" node type), and another field named "field_tags" (on "article" node type). - We assume we have a views page at "animals" which gives an overview of the available animal categories.
Desired breadcrumb:
Home » Animals » Mammals » Whales & Dolphins » Flipper
Quick summary
(crumbs-7.x-2.x only)
Visit Admin > Structure > Crumbs > Entity parent > Taxonomy
Specify "animals" as the parent path pattern for "Animal category" taxonomy terms.
Visit Admin > Structure > Crumbs
Make sure the following plugin keys are enabled:
taxonomy.termReference.field_animal_category.node.* (medium priority)
taxonomy.termParent.categories (medium priority) (*)
crumbs.entityParent.taxonomy_term.categories (low priority) (**)
(*) probably already implicitly enabled via * wildcard, so you don't really need to take action.
(**) probably already implicitly enabled via * wildcard, but you need to adjust the priority.
More detailed explanations for each step:
On node pages (node/%)
We want that nodes which have a category set in "field_animal_category" use the category as the breadcrumb parent.
On the other hand, we don't want that field_tags plays any role in the breadcrumbs.
Long story short (spoiler):
Enable the plugin key taxonomy.termReference.field_animal_category.node.*, by moving it into the "enabled" section (set the priority as you see fit).
Longer explanation:
Watch out for plugin keys that begin with taxonomy.termReference.. E.g.:
taxonomy.termReference.* (disabled by default)
taxonomy.termReference.field_tags.*
taxonomy.termReference.field_tags.node.*
taxonomy.termReference.field_tags.node.article
taxonomy.termReference.field_animal_category.*
taxonomy.termReference.field_animal_category.node.*
taxonomy.termReference.field_animal_category.node.animal
The taxonomy.termReference.* is "disabled by default", which causes all the child plugin keys to be disabled as well.
This is necessary because usually only some term reference fields are supposed to have a meaning in the breadcrumb.
We now move the taxonomy.termReference.field_animal_category.node.* into the "enabled" section.
This way, all nodes that have the field_animal_category set will use that for the breadcrumb parent, no matter which node type.
Still doesn't work?
Look in Admin > Structure > Crumbs > Debug, type a node url, and see the different parent-finding plugins in action.
Maybe you need to readjust the priorities.
On taxonomy term pages (taxonomy/term/%, termParent)
You want that taxonomy term pages use the parent term as the breadcrumb parent.
Solution:
It probably already works out of the box!
The plugin key to enable would be either taxonomy.termParent.* or taxonomy.termParent.animal_categories.
However, since none of these is "disabled by default", they are probably already doing their job just fine.
Still doesn't work?
Look in Admin > Structure > Crumbs > Debug, type a node url, and see the different parent-finding plugins in action.
Maybe you need to readjust the priorities.
Top-level taxonomy term listing
We create a views page on path "animals" and want to use that as the breadcrumb parent of top-level animal categories (those that don't have another category as a parent).
crumbs-7.x-2.x branch:
Go to Admin > Structure > Crumbs > Entity parent > Taxonomy
On "Animal categories" vocabulary, type "animals" as the parent path pattern.
Then go to Admin > Structure > Crumbs to readjust the weights.
Make sure that crumbs.entityParent.taxonomy_term.animal_categories has a lower priority than taxonomy.termParent.animal_categories.
crumbs-7.x-1.x branch:
Create a custom module with a Crumbs plugin, that sets "animals" as the parent path for animal categories. Good luck with that :)
See http://drupal.org/node/1004398
You then visit Admin > Structure > Crumbs and make sure the custom plugin is enabled.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion