Currently, menu trail tokens (mostly used in pathauto configuration) are built using the titles of menu item parents. Often, however, the parent item has a path alias that differs from the menu titles. E.g., a parent item may have an alias built with CCK field tokens or manually coded.
The attached patch adds a new token, ['menu-trail-parent-alias']. This token will be set to the alias (or, if there is no alias, the original path) of the menu trails parent item of the node's type.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | menu-trails-parent-path-token.patch | 1.42 KB | nedjo |
Comments
Comment #1
nedjoPatch.
Comment #2
sunHm - why an alias and not the path?
Powered by Dreditor.
Comment #3
nedjoThe main use I have in mind is for pathauto, where we want aliases and not system paths.
Say I have a panels node with the title and menu item title "My landing page for articles." I don't want such a long alias, so rather than using a title token I manually set an alias of "articles". I set this node's menu item as the menutrails parent for nodes of type article.
Now I can configure pathauto for articles to use
['menu-trail-parents-path']/['title-raw']. If I create an article with the title "Some article", if we used the system path for the alias, we'd get node/123/some-article. By using the alias, we get what I want: articles/some-article.Comment #4
Xart commentedThanks for ptach. I'd like this feature to include to de module.
It's useful...
Comment #5
Xart commentedI'd try it and not function for me...
Has anyone using this patch?
Comment #6
SophieG commentedThanks it's working !!
Comment #7
alexgreyhead commentedUnless I'm doing something wrong, this isn't working for node types which don't have a default parent set in the menutrails settings; I was hoping it would be able to pick up the path of the page's parent according to the menu system, but that's probably a project for another day. Oh well :)
Comment #8
linneawilliams commentedThis patch doesn't seem to be working for me. I'd like to use the node's parent's path as the base for the automated alias. Like so:
[menu-trail-parent-alias]/[title-raw]
And the [menu-trail-parent-alias] can be a hand-written/arbitrary URL.