Menu path in Pathauto

17,984

Solution 1

Just an update in case anyone comes across this with a more recent version of Pathauto/Token. This worked for me:

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

Solution 2

[node:menu-link:parent:url:path]/[node:title]

If the node is not in the menu, then it does not create an alias. Otherwise this seems to work for n-tier menus.

Solution 3

I think it has to be this pattern now:

[node:menu-link:url:path]/[node:menu-link]

"path" instead of "alias"

Solution 4

You'll need to install the contrib Token module as well -- although a lot of the features of Token are part of core in D7, some of the edge case tokens (like the full menu path of a given node) aren't provided by core automatically.

With that installed, I believe that [node:menu-link:parent] or [node:menu-link:parent:url] should work.

Solution 5

The pattern that works for me is the following:

[node:menu-link:parent:url:alias]/[node:menu-link]

I also intalled the Token module like Eaten suggested. Don't know if [node:menu-link:parent:url:alias] is part of core or lives in contrib.

Share:
17,984

Related videos on Youtube

dantz
Author by

dantz

Updated on August 30, 2020

Comments

  • dantz
    dantz about 3 years

    How do I get pathauto under Drupal 7 to generate a URL alias by the full menu path?

  • dantz
    dantz almost 13 years
    Unfortunately none of these tokens do what I want. First one gives me only the parent but if a Menu-Item is on the third level the first one will be missing. And the last one gives the absolute path to the parent node.
  • asiby
    asiby over 11 years
    Using [node:menu-link:parent] or [node:menu-link:parent:url] is not a good solution. We ran into cascading issues where node aliases were being badly named because the parent menu was not named properly. And these tokens do not calculate the full menu tree leading to the node being saved. You have to really fix the parent item of a menu item in order to see any change.
  • Mario Awad
    Mario Awad over 11 years
    Works perfectly for me. Thank you. Just in case anyone is wondering, I'm using Drupal 7.14, Pathauto 7.x-1.1, and Token 7.x-1.1 (The latest versions as of 2012-07-16). Cheers.
  • raam86
    raam86 about 11 years
    There should be some more meat to this answer
  • spatical
    spatical over 9 years
    In case the node is not added to a menu. I prefer using the node title as the final segment/token. This will prevent the node from having no url alias if forgotten: [node:menu-link:parents:join-path]/[node:title]
  • AlxVallejo
    AlxVallejo about 9 years
    Also note that the join-path of the parents refers to the title of the parent and not the url. So this could cause conflicts if you change the title of the parent and then create the alias of the child.
  • AlxVallejo
    AlxVallejo about 9 years
    This grabs the un-aliased parent path

Related