How do I get pathauto under Drupal 7 to generate a URL alias by the full menu path?
相关问题
- Drupal 8: How do I customize a form widget to show
- How to balance webserver bandwith usage?
- drupal :: order complete hook and upgrade user per
- Change redirect in Drupal 7 for Password Recovery
- Adding attachment to Jira's api
相关文章
- Render a Drupal node
- How to allow multiple blocks in a module of Drupal
- How can I redirect a Drupal user after they create
- Drupal 6: Getting custom fields into the database
- Drupal 7 retain file upload
- Drupal - Set 'user/%/edit/uprofile' to def
- Drupal Session User id for independent script
- how to construct an https POST request with drupal
Enjoy!
I ended up using:
[node:menu-link:parent:url:path]/[node:menu-link]
Heavy caution though: If the node does not have a menu link, you'll end up without an automatically aliased page. On the bright side, this might make you aware of orphan pages. (Consider it a feature!)
Note that using the pattern:
[node:menu-link:url:path]/[node:menu-link]
will only give the node's menu link, not that of the parent (which would be needed to reference the parent's path).
Or the pattern:
[node:parent:url:path]/[node:menu-link]
throws an error in my instance of Drupal 7 about invalid tokens (even though I have the token module installed).
I think it has to be this pattern now:
"path" instead of "alias"
The pattern that works for me is the following:
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.If the node is not in the menu, then it does not create an alias. Otherwise this seems to work for n-tier menus.
If you're attempting to make aliases for pages that are 3rd level or deeper, for example:
and you want the alias for Level 3 page to look like
http://domain.com/level-1/level-2/level-3
, I got it to work for me by setting my pattern to:Notice that I added
:parent
to the token, and for the first one I added it twice.