3

I downloaded the Pathauto module to have the taxonomy aliases generated dynamically. The problem is that the pattern apparently expects a fixed depth, while my taxonomy is not that stiff - some items have one, and some up to 3 branches underway. Can such a scenario be addressed by pathauto?

  • Which drupal, token and pathauto versions do you use? – P4tient Jun 21 '11 at 17:27
  • Drupal 7.0 (that's what Reports > Status shows, although I'd swear I downloaded 7.2), token-7.x-1.0-beta2, pathauto-7.x-1.0-beta1 – Artur Jun 21 '11 at 19:47
1

Well, I'm really surprised such important functionality hasn't been implemented in D7.
Here we go: too much talk, not so much work.
In short: currently there's no token for dynamic taxonomy depth like termpath in D6.

| improve this answer | |
  • I'm too fresh to Drupal to arbitrarily say it hasn't been implemented. What syntax have you used in termpath/D6? I would gladly give it a try. – Artur Jun 21 '11 at 21:33
  • In token-6.x-1.16 it's catpath. – P4tient Jun 22 '11 at 5:17
  • OK, in catpath then - what expression did you have to handle variable depth paths? Let me try that in D7 – Artur Jun 22 '11 at 13:15
  • catpath provides taxonomy tree so far. But there's no such an option in D7. – P4tient Jun 22 '11 at 14:01
  • Frankly, it's a bit of disappointment. – Artur Jun 23 '11 at 15:24
0

I'm also quite miffed by this missing bit of critical functionality.

A workaround you could use for now is to use the token [node:field-section:url:relative] (replace "section" with the name of the taxonomy term that you've made a field on your node content type).

But then you must do a second step and that is to turn OFF the default handling of slashes in strings in the Pathauto > Settings tab. It is all the way at the bottom under "Punctuation". You must change the dropdown setting to "No action (do not replace)".

Although this should get you where you want, it is risky, as it now opens up the possibility of 404 errors if there is an unencoded slash in the title of a node or any other field that would find its way into your pretty URLs.

I'm also trying to get this quick and dirty module to work -- http://drupal.org/node/741914#comment-5025862 -- but thus far it is only outputting the deepest term in the URL and not the entire hierarchical chain. I'll keep you posted if I do get it to work.

| improve this answer | |
  • I did get the "quick and dirty" module to work, after all. – Adam Friedman Nov 15 '11 at 17:48
0

Since this question was asked a lot of things changed and this is possible now so for anybody that stumbles upon this question the way to go is using the "join-path" token for the full url including the current term

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

It will output all the parent's names no matter if you have 1,2 or ..x making the depth dynamic.

| improve this answer | |

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.