2

I have a view that displays terms hierarchically via a view attachment, but neither the URL nor the breadcrumb keep track of where it is in the hierarchy. For example, a taxonomy structured like the following.

  • Category
    • Term I
      • Term A
        • Term 1
    • Term II
      • Term B

It displays a page listing Term I and Term II. Upon clicking on Term I, the user is taken to the page for Term A, which is a list of its sub-terms (Term 1). Upon clicking, the user is taken to a list of nodes tagged with that therm.

The path and breadcrumb for each of these pages is, sequentially, the following.

  • /category
  • /category/term-i
  • /category/term-a
  • /category/term-1

I would like instead for the breadcrumb and path to be the following.

  • /category
  • /category/term-i
  • /category/term-i/term-a
  • /category/term-i/term-a/term-1

I've tried the Hansel and Custom Breadcrumbs modules, but I have been unable to configure them properly, or they just don't provide the functionality I need.

I'm using Drupal 7 with a theme based on Omega, so any answer that include instructions to insert code into template or other theme files need to include information about where that code belongs in Omega.

2

These are two separate questions. One about the path, another about the breadcrumb.

Breadcrumbs:

Disclaimer: The solution presented here may need more tweaking, if your taxonomy/term/% is replaced by a views page with contextual filter. (I never do that, there are other ways to achieve the same)

Crumbs will do the trick. 90% of the task out of the box. If not, check this doc: http://drupal.org/node/1984484

You need some manual work to make "/category" the top-level breadcrumb item for all the terms: (this explanation is for the 7.x-2.x branch)
Visit Admin > Structure > Crumbs > Entity parent > Taxonomy
Set 'category' as the parent path for your vocabulary.
Go back to Admin > Structure > Crumbs
Move crumbs.entityParent.* into the "Enabled" section, and give it a low enough priority.

Path:

I suppose you have pathauto installed already.
Go to Admin > Configuration > Search and metadata > URL aliases
Look at "Taxonomy term paths".

I read somewhere that the following pattern will do the trick:

category/[term:parents:join-path]/[term:name]

Not tested myself. Good luck with it :)

Your Answer

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

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