Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Given that the tokens available for use in Pathauto patterns appear to have changed radically, is there any equivalent to the very useful catpath pattern from D6? I don't see anything that looks similar...
The nearest equivalent I can see would be to assemble it by putting together [term:parents:join-path] and [term:name] separated by a slash, but wouldn't that lead to a double slash in the URL if some terms didn't have any parents? Or would Pathauto automatically correct for that?
Comments
Comment #1
fengtanMaybe you can use
[term:parents:join-path]/[term:name]
in D7 where you used[catpath]
in D6.Pathauto trims duplicate separators in
pathauto_clean_alias()
anyway, so you should not end up with double slashes in the URL.Comment #2
kenorb CreditAttribution: kenorb commentedThe same problem here:
It seem pathauto wrongly converting term:catpath from D6 into term:name in hook_update
breaking the consistency of old paths.
I've tried [term:parents-all] and [term:parent:parents:join-path], but it seems it doesn't work as expected.
See the comment from token_node.inc:
Comment #3
kenorb CreditAttribution: kenorb commentedBy applying drush support for Pathauto at #867578: Add drush commands for bulk alias updating/deleting you may quickly test what could be suitable for you, e.g.:
Try also:
[term:parent:parents:join-path], [term:vocabulary]/[term:parent:parents:reversed:join-path]/[term:name], but these doesn't work for me, are empty.
Comment #4
kenorb CreditAttribution: kenorb commentedThe best token I've found equivalent to:
is:
Comment #5
Dave ReidActually [term:parents:all:join-path]/[term:name] is the direct replacement for [catpath-raw].
Comment #6
kenorb CreditAttribution: kenorb commentedI'm not sure, because [term:parents:all:join-path]/[term:name] doesn't work for me as a Forum pattern.
it generates the aliases like:
and it looks like token is ignored or empty.
When using
it generates the aliases like:
Comment #7
Dave ReidAck, sorry that's my fault. The token is actually
[term:parents:join-path]
.Comment #8
kenorb CreditAttribution: kenorb commentedYes, it works, thank you.
Comment #10
Summit CreditAttribution: Summit commentedHi thanks, this helped. I needed:
greetings,
Martijn