0

how to make listing page created by views in the breadcrumb of single item of specific content type like so:

Home >> Activities: (created by views) Home >> Activities >> item page: (desired breadcrumb)

2
  • 1
    Do you mean if you navigate to node content listed in views you would like to see Home >> Activities >> Node Title as Breadcrumb ?
    – Anil Sagar
    Mar 9, 2014 at 15:32
  • No, when i go to item page details not the listing of views Mar 9, 2014 at 18:17

2 Answers 2

1

Here's the Old School way of doing it.

I'm assuming that this view is showing a content type called Activities and the view will be at /activities and all the activities (the nodes) the view is showing need to be at /activities/some-activity-title /activities/some-other-activity-title etc...

Have a view named Activities. In the view settings set up Add this to your "Main Menu" menu in the root.

enter image description here

Install PathAuto and set up the template for activities to be activities/[node:title] over at admin/config/search/path/patterns

Then set up your content type to always add a menu item to the Main Menu -> Activities section I did this with articles:

enter image description here

After that, you will need to edit your theme to show the current page or add a module to do so. See Show current page on Drupal 7 breadcrumb

When it's all said and done... you will have a breacrumb with what you wanted. This is it without the current theme or module fix.

enter image description here

1

(EDIT)
Drupal core will build breadcrumbs based on the menu structure. So if you manage to create a menu link for each of your activities, then Drupal core has you covered (see the answer by General Redneck).
If you don't want a new menu link per activity node, then you can use Path breadcrumbs or Crumbs, see below.
(/EDIT)

There are different modules that can help you with breadcrumbs, and I am sure more than one of them can help with this particular issue.

One of them is Crumbs. If you choose this, here are some steps for configuration (after enabling the module):

  1. Go to admin/structure/crumbs/entity-parent, and specify the views page as the parent path for the node type of your choice.
  2. On admin/structure/menu, edit the main menu (or another menu), create an item that links to the views page, and give it a title like "Activities". (*)
  3. On admin/structure/crumbs, make sure that the menu.link_title.main-menu and menu.hierarchy.main-menu are enabled. Or just enable menu.*.
    (enabling means to move those lines up into the "Enabled" section with drag+drop)
  4. To see what going on behind the scenes, you can visit admin/structure/crumbs/debug.

(*) Creating the menu item is one option you have so that Crumbs can determine a title for the breadcrumb item that points to the activities view. There are other ways, but this is the most straightforward, and you probably want to create this menu link anyway.

5
  • You actually don't need Crumbs to do this at all. It seems like you did at least the first step of what I did in my answer. Though the entity parent is a handy feature for those nodes you don't put in the main menu if the usecase calls for it. I'm not so sure that crumbs is the one determining the title for the breadcrumb at that point.. I assume it would be Drupal Core. Mar 9, 2014 at 20:38
  • You do not always want to create menu links for every piece of content. E.g. I usually don't want to create menu links for news articles, events, and stuff like that.
    – donquixote
    Mar 9, 2014 at 21:14
  • 1
    Regarding the title of a breadcrumb item: The way Crumbs works, it will attempt different ways to determine a title. If the respective path already has a title or title callback in the menu_router table (via hook_menu()), then it can use just that. But this is not always the case, especially for Views pages. So instead, you can create a menu link with a title, which will be picked up by Crumbs if the respective plugin is enabled. If Crumbs cannot find a title for a breadcrumb item, it will skip that item, leaving users confused.
    – donquixote
    Mar 9, 2014 at 21:19
  • The added advantage of doing something like adding menu links to all the different news items and events would be that your sitemap would be complete and you would have better SEO. Obviously, you are right in that the massive mess the menu would eventually become wouldn't always be wanted... but that's also why you put it under parents where they can be on lower levels of the navigation tree... and of course don't show everything expanded. Thanks for the clarification on Crumbs. Going to check into it! Mar 9, 2014 at 21:25
  • The question is whether everything belongs into the sitemap (e.g. news articles), and even if it does, whether the menu is the best way to achieve that. It would be useful to have some 3rd party reference about this.
    – donquixote
    Mar 9, 2014 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.