6

I am generating breadcrumbs from URL arguments as described here.

I have a vocabulary that looks like this:

Arts-> Performing-> Dancing-> Ballet

I want my url to look like this: arts/performing/dancing/ballet

Using the pathauto module, I can do this for taxonomy terms:

[term:parent]/[term:name]

Which, on the Ballet page, gives me the following; not what I want:

dancing/ballet 

If I use parents instead of parent, ([term:parents]/[term:name]); this is close but not quite:

arts-performing-dancing/ballet

How can I get from arts-performing-dancing to arts/performing/dancing?

5 Answers 5

7

Found a better way that scales

[node:menu-link:parents:join-path]/[node:title] 
0
9

Try something like this as your vocabulary pattern:

[term:parent:parent:parent:name]/[term:parent:parent:name]/[term:parent:name]/[term:name]

And your last question should go away.

Just be sure to repeat the parent: part at least as many times as max term depth expected in your vocabulary. Pathauto will smartly skip overhead items.

I know it's not super-scalable, but it works for me.

1
  • That did it! If performance becomes an issue I'll look for a better way, but this is definitely good enough for now. Commented Apr 1, 2012 at 13:51
4

All these answer are right but you can also use the Taxonomy entity index module which provides taxonomy tokens. Problems begin when your term contains slashes.

The taxonomy entity index module maintains a normalized index of all terms associated with a specific entity and revision. The core {taxonomy_index} table only maintains its data for published nodes. This module maintains its data for all entity types (regardless of published or not) and also indexed by revision.

2

If you find pattern for Drupal 8, use [term:parents:join:/]/[term:name]

Example result: arts/performing/dancing

Because our delimiter is slash, don't forget to disable removing the slashes in Administration > Configuration > Search and metadata > URL aliases > Settings, go to /admin/config/search/path/settings, Punctuation section, find Slash (/) and choose "No action (do not remove)" in dropdown.

0

Use the following pattern for the path alias: [term:i18n-vocabulary]/[term:parents:join-path]/[term:i18n-name].

Your Answer

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

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