Menu path in Pathauto

2019-03-09 17:49发布

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

10条回答
Root(大扎)
2楼-- · 2019-03-09 18:38

This is the solution I use:

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

It will separate parent menu items with a dash. That is what I need.

查看更多
Animai°情兽
3楼-- · 2019-03-09 18:40

For anyone who stumbles upon this answer, and wonders how to add this:

Configuration > Search and Metadata > URL aliases, then create under "Patterns" tab.

查看更多
Animai°情兽
4楼-- · 2019-03-09 18:41

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]

查看更多
Juvenile、少年°
5楼-- · 2019-03-09 18:48

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.

查看更多
登录 后发表回答