By jan

2012-01-21 17:05:27 8 Comments

Pathauto seems to have a different way of aliasing taxonomy hierarchy.

From Taxonomy Menu:

  1. Classifieds > Cars > Aston Martin > DB9 Coupe
  2. Classifieds > Jobs > Accounting

What I want is something like this for the url:

  • classifieds/jobs/accounting (not accounting-jobs-classifieds)

(Note that Pathautho generates this with dashes in reverse order as well.)

In Pathauto, I'm using this pattern: Default path pattern (applies to all vocabularies with blank patterns below)




@rwilson0429 2014-08-16 13:46:01

The keys to getting this to work is:

  • install and enable the Entity API, Entity Tokens, Path Auto and Taxonomy modules.
  • create a field on your content type and set Field Type to Term Reference and name it something like 'field-content-category' (machine name)
  • Set the Number of Values, aka, 'Maximum number of values users can enter for this field' to 1 (very important if you want to use the joined-path tokens which automatically adds a / between the path elements).
  • set the URL patterns (admin/config/search/path/patterns) to something like '[node:field-content-category:parents:join-path]/[node:field_content_category]/[node:title]'

@hazard 2012-09-16 22:31:17

This one works for me on Drupal 7.15 with Token 7.x-1.3 and Pathauto 7.x-1.2:


As brunops stated in the second answer, join:%separator% does the magic. It replaces the default dash with %separator%.

A big thanks to brunops!

@Rantiev 2014-07-28 11:54:59

This have to be right answer! It doesn't matter at all how many levels you have, this will work.

@NenadP 2012-04-22 12:33:20

There is a clever way to do this by using join:/

In my case, I used:


where field-taxonomy-skolski is the field for choosing the term from the taxonomy tree. Forward slashes will be stripped, though there is a setting under

Administration » Configuration » Search and metadata » URL aliases » URL aliases - settings

at the bottom of the page for PUNCTUATION drop-down. Set to slash (/) "no action" instead of "remove".

@Artur 2012-04-22 17:53:47

Bingo! I myself offered the above non-scalable solution (…) and of course I like this one much better. I'd swear that token option hasn't been there when I was struggling to get that pattern working. Thanks!

@user25536 2014-01-22 09:30:23

[...:join:/] did not work for me but [...:join-path] did. Remark: with join-path you can not choose the separator. It just uses / as separator.

@coderama 2016-11-29 09:07:31

If this doesn't work for you, you probably need to install and enable the "entity" module.

@Martin Klíma 2018-11-07 11:54:09

Pattern for Drupal 8 is a little different, e.g.: [term:vocabulary]/[term:parents:join:/]/[term:name]

@brunops 2012-01-21 18:22:09

With the Token module enabled, you can set a pattern like this:


Make this pattern as long as you want. Your paths will then become:


and so on...

@jan 2012-01-27 07:11:29

Many Thanks to you! So if i have a taxonomy hierarchy 5 levels deep (including vocab) that would be [term:vocabulary]/[term:parent:parent:parent:name]/[term:par‌​ent:parent:name]/... etc.., right? I wish tokens module can be configured in such a way you don't need to define parent-child repeatedly in this manner. What if unexpectedly your tree becomes 6 levels then you would have to delete and update your paths to include another and then becomes 7 levels deep and so on.. i mean, if one user added terms one level down, he cannot see his contents unless a admin updates pathauto!

@Paul 2015-04-21 17:45:05

Even though this is the accepted answer, please review @NenadP's answer for a scalable solution.

@7wonders 2012-01-21 18:08:59

Well I would recommend using something smart like:


But I cant for the life of me get it working neither. So instead I recommend the following but you can only go as deep as the hierarchy allows (can be seen in replacement patterns). If you add terms deeper in the hierarchy you will have to update the pattern also.


Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] Taxonomy hierarchy via separate dropdowns

1 Answered Questions

Taxonomy parent terms - pathauto

2 Answered Questions

[SOLVED] Unable to view Taxonomy term page: Access denied

2 Answered Questions

[SOLVED] How to change URL alias when importing books?

2 Answered Questions

[SOLVED] Identifying the level of menu items in the item array?

  • 2012-03-01 21:11:33
  • Ashlar
  • 245 View
  • 1 Score
  • 2 Answer
  • Tags:   routes

1 Answered Questions

[SOLVED] drill down taxonomy node count using views

1 Answered Questions

[SOLVED] How to get Taxonomy Menu working properly with Contextual Filters in Views?

1 Answered Questions

[SOLVED] taxonomy cck pathauto

Sponsored Content