Posts tagged with "Drupal 7"

Posted: Monday, February 13th 2012

If you ever used the Pathauto module and the very useful [menupath-raw] token in Drupal 7 this is gone.

Using the latest stable release of Token module, this is now the way!

[node:menu-link:parents:join:/]/[node:title]

 

The use case for this would be that you have a page at /shop, and you want to create a sub-page under it (let's say we're creating a Help page), and have that hierarchy reflected in the URL, you'd set the parent menu item for your new node as "Shop", then you'd get the URL:

/shop/help

If you just had the node at the top level of a menu, not nested in any way you'd get:

/help

Important! To prevent pathauto stripping out slashes found within tokens you must go to Pathauto's settings, under punctuation for "Slash" (/) set this to "Do nothing". Don't worry about double slashes as Pathauto will take care of that for you.