Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Like in menu_active_trail_breadcrumb() where Drupal core removes the latest item in the breadcrumb if it is equal to the current path, the theme should do the same before optionally adding the page title.
This is in particularly important if the first submenu item is the same as its parent which is often used for the main menu as the main menu item triggers the drop down and can't actually open the menu link itself.
A patch follows in a second.
Comment | File | Size | Author |
---|
Comments
Comment #2
jurgenhaasComment #3
markhalliwellI'm confused... the actual breadcrumb items are from core, so it already pops off the current page (which is why there's a theme setting to add it back, although not as a link).
Comment #4
jurgenhaasSample menu structure:
Top level: "About us" with 5 sub-items
First sub-item is also "About us" to make this item accessible
Breadcrumb: Home / About Us
In menu_get_active_breadcrumb we have 3 items and remove the latest:
- Home
- About Us
- About Us
In bootstrap_preprocess_breadcrumb we have 2 items, remove the latest and add the current title
- Home
- About Us <= link removed and added as title
This is just an example which shows that we should remove the latest item twice.
Comment #5
markhalliwellSo, you're manually adding this link. That isn't a bug.
There's several ways to overcome this particular issue, least of which is renaming the 2nd "About Us" to something like "Overview" or "Introduction".
Regardless, even if you didn't want to go this route, this kind of customization is site/design specific. You can override in a sub-theme.
Comment #6
jurgenhaasWell, renaming the overview item wouldn't change the fact that the breadcrumb will then contain one item too much - from a UX point of view. And yes, we can solve that in subthemes, but the behaviour of the drop down main menu is very common in bootstrap and hence a global solution would have been nice.