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.
In some circumstances, some content types (like Articles) have no designation in the menu, but menu links can get you to a page like /news where news is listed, and then you get to the detail page.
How can I add the node title to the breadcrumb in this circumstance to match consistency with the rest of the site in this scenario?
Comment | File | Size | Author |
---|---|---|---|
#7 | menu_breadcrumb-2845426-7-add-current-page-to-breadcrumb-if-is-not-in-the-menu.patch | 4.25 KB | akalam |
Comments
Comment #2
rphair CreditAttribution: rphair at COSD commentedThere's not enough detail here to understand the circumstance you are talking about, but I suggest this may be a duplicate of issue 2804943 which provides for setting the breadcrumb trail by context (e.g., by content type). The module option "Append current page to breadcrumb" should then allow adding the node title itself.
If that is not what you are talking about here, then please be far more specific about what you are trying to do.
Comment #3
kevinquillen CreditAttribution: kevinquillen at Velir commentedI read that thread and really don't want to drop on context and context active trail for this.... also append current page title to breadcrumb did not work if the node was not in the menu.
I wound up having to do this for content types with no menu setting:
Comment #4
rphair CreditAttribution: rphair at COSD commentedIf a node truly has no association with a menu, then Menu Breadcrumb does not, and should not, generate any breadcrumb for it (unless its active trail is manipulated to make it look like it has that association). When there's no menu association, its designed behaviour is to roll over and let some other breadcrumb builder generate the breadcrumb.
We don't require Context Active Trail / Context UI to use with this module, since the context for a breadcrumb builder is set by its own
applies()
function: therefore another module can take over where Menu Breadcrumb leaves off. The issue of "context" came up in the issue thread I suggested because the Taxonomy Attachment feature was added to support blogs with taxonomy-based categorisation but couldn't otherwise generate the same kind of breadcrumb trail for uncategorised articles.Therefore, this module works as designed because, in your example, the articles showing in the /news view would have a taxonomy membership which determines their breadcrumbs, assuming that taxonomy term's menu has its "Taxonomy Attachment" box checked in the module settings... and if you tick the "show title" settings, it shows the node title after those breadcrumbs.
And if they don't, and you're not somehow setting the active trail explicitly (like through "context") to an applicable menu, then Menu Breadcrumb doesn't apply. To talk about how this module would work for all nodes of a certain content type is pointless, since such a breadcrumb builder would be content-type-based, not menu-based.
Comment #5
akalam CreditAttribution: akalam at Metadrop commentedReopening.
We think that this can be part of this module to be more flexible, not needing extra modules to have a functional breacrumb.
Maybe an extra setting can be implemented to have the current page title appended even if it has no menu link associated to the breadcrumb to make it look and feel coherent.
Comment #6
akalam CreditAttribution: akalam at Metadrop commentedComment #7
akalam CreditAttribution: akalam at Metadrop commentedI forgot to save the configuration :p. Also updated the settings and schema.
Comment #8
rphair CreditAttribution: rphair at COSD commentedthanks for contribution... testing together with patch for issue 2977598; will check them both ASAP into dev when done.
Comment #9
RumyanaRuseva CreditAttribution: RumyanaRuseva as a volunteer and at FFW commentedI don't think the suggested patch solves the original feature request - it only adds the current page to the breadcrumb, but it is not under any parent page such as "news" listing as requested by the reporter.
I recommend using Menu position module for defining menu rules without adding the individual articles to the menu.
It can be used in combination with Token Conditions for even more complex conditions like menu position depending on a taxonomy tag field value.
Comment #10
rphair CreditAttribution: rphair at COSD commentedThanks @RumyanaRuseva - I agree with your reasoning. There are a lot of ways of dealing with menu-less articles and all of them, except for taxonomy memberships, are beyond the scope of this breadcrumb builder. Still I would like to leave this open for a while to give @akalam or others a chance to address comment #8.
Comment #11
rphair CreditAttribution: rphair at COSD commentedNo further activity in over 3 weeks, so closing this again with the further rationale given in the last 2 comments.