0

I have a menu with some items that link to some views which filter content type associated with vocabulary terms.

Navigation

Menu ITEM -> views page vocabulary 

Result :

my-site.com/vocabulary 

(here it’s the vocabulary i added in view / PAGE SETTINGS / path so it is not automatically generated from vocabulary)

When i click on on one of the articles, i can see the full content.

It works fine.

Navigation :

Menu ITEM -> views page vocabulary -> article

Result :

my-site.com/title-of-article

My question is related to breadcrumb.

The native breadcrumb of Drupal 8 doesn’t work properly. I’ve made a lot of search and discover that breadcrumb is not perfect in Drupal 8.

So I have tested 2 modules : Menu Breadcrumb and Easy Breadcrumb

Then, i can now display the Breadcrumb but i don’t see the taxonomy vocabulary in it.

I have :

home / Title of article

I would like to have

home / vocabulary / Title of article

or

home / (path view) / Title of article

I’ve sen other modules but they are not ported to D8 for now :

How can I handle this ? Do I have to create a custom module to handle vocabulary terms in breadcrumb and in url ?

  • When you sync breadcrumbs and paths with Pathauto, so that each part of the path resolves to a route, then Drupal 8 builds the breadcrumbs automatically. Otherwise you need a contrib or custom breadcrumb builder module or add the missing breadcrumbs in a preprocess hook in theming if you don't want to use a module. – 4k4 Jan 8 '18 at 16:22
  • @4k4 Thank for the suggestions. I searched for a D8 contrib but didn’t found (for D7, there is a large choice). I’m going to dig "preprocess hook" or the custom module. Could you please explain what you means by "sync breadcrumbs and paths with Pathauto,". In pathauto, iI only see [node:title] pattern possible for content (no token for taxonomy). – Sébastien Gicquel Jan 9 '18 at 15:08
  • It's hard to explain this more, in D8 the breadcrumbs are built according to the path structure. You only have to make sure, that all path components resolve to a route (test this in the browser by removing /xyz from the end of the path one by one and see if you still get a page and not a 404). About Pathauto, you should see more tokens than only one. – 4k4 Jan 9 '18 at 15:36
  • @4k4 I see more tokens but no token to build a correct path based on "view page path". I'll check again. I understand what you explain about route. I need to have correct path in order to build a correct breadcrumb and also to know where is user. For now, it’s like content has no hierarchy. – Sébastien Gicquel Jan 9 '18 at 15:45
  • If all paths of a content type point to the same view, than you can use a fixed path component /view-page-path/. You only need a token, if this depends on a node field. – 4k4 Jan 9 '18 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.