Closed (duplicate)
Project:
Token
Version:
7.x-1.1
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 Nov 2010 at 22:17 UTC
Updated:
23 Jun 2015 at 14:11 UTC
Jump to comment: Most recent
Comments
Comment #1
aanjaneyam commentedAnybody please?
Comment #2
dave reidYou can use something like [node:menu-link:parent:path]/[node:menu-link:title] right now that will work as long as the parent menu link already has its alias assigned.
Pathauto for D7 is not going to provide any tokens. We're going to put them in Token module.
Also see #860082: BIKESHED: Token for a term or menu item's entire tree/hierarchy
Comment #3
aanjaneyam commentedThere have been several DEV releases of token in the last few days. I was wondering if there has been any development in the above mentioned area.
Comment #4
dave reid@amsri: Have you tried [node:menu-link:parent:path]/[node:menu-link:title] to see if that worked for you yet?
Comment #5
aanjaneyam commentedWell it works in few cases but doesn't in most cases. May be I might need to take some other preparatory/preliminary step which I am missing. What could i do to make it fully work on each node.
Comment #6
oakulm commentedI've been using this [node:menu-link:parent:url:alias]/[node:menu-link:title] and it works fine. Only problem is that you have to make sure every page is in the menu tree otherwise aliases get screwed bad...
Comment #7
theshanergy commented#6 worked for me, which is strange because it seems like it should generate an additional forward slash on top level pages..
subscribing for an 'all-in-one' token like [menupath-raw]
Comment #8
davidfsmith commented#6 works for me, but I really wanted to have the node language at the start, but prefixing the pattern with [node:language]/ causes (for example) lots of en/en/en at the start of the URL on a page three levels deep. There is probably a better way.
Comment #9
aanjaneyam commentedThe option suggested in #2 doesn't seem to work any more. I get error on pattern settings page. The error is
The Pattern for all Article paths is using the following invalid tokens: [node:menu-link:parent:path].
The Pattern for all Basic page paths is using the following invalid tokens: [node:menu-link:parent:path].
The Pattern for all Course paths is using the following invalid tokens: [node:menu-link:parent:path].
The Pattern for all Department paths is using the following invalid tokens: [node:menu-link:parent:path].
Comment #10
dave reid@amsri: See #7. Use [node:menu-link:parent:url:alias]
Comment #11
aanjaneyam commentedOh! Sorry. Thanks for reply.
Comment #12
vegardjo commentedSubscribe, an equivalent for menu path would be much appreciated!
I've tried:
[node:menu-link:parent:url:alias]/[node:menu-link:title]which works fine for many pages, but for pages that fall under the front page you get this:
I've also tried
[node:menu-link:parent:title]/[node:title]which solves the problem above, but doesn't work if you have more that one level of links..Comment #13
knalstaaf commentedI'd say
[node:menu-link:parent:title]/[node:menu-link:title]works best for me. It renders url's like domain.com/products/brand-new-product when having a menu structure like this:(Drupal 7.2)
Comment #14
AndrewJarvis commentedReading over this thread still begs the question from #6, is it still an issue that if a page does not have a menu item the path will be screwed?
Thanks!
Comment #15
kevinquillen commentedSome solution like #35 here (http://drupal.org/node/860082) is what I am looking for.
Edit: #35 works fine, and works for nodes a few levels deep in a menu.
Comment #16
mustanggb commentedNone of the suggestions in this thread work for all situations
i.e. Things start to break for level 3 and higher menu or for sub-menu's of menu items that don't have the url you would expect (usually because they are themselves aliases of other pages)
Closing this in favour of getting a new token added along the lines of: http://drupal.org/node/860082#comment-4649530
Comment #17
dave reidNote that due to change http://drupal.org/node/1265672, you should be using [node:menu-link:parent:url:path] instead of [node:menu-link:parent:url:alias].
Comment #18
sense-designPlease take a look at http://drupal.org/node/1266928#comment-5115652
Comment #19
ressa@Dave Reid, thank you.
[node:menu-link:parent:url:path]isn't included under the "Replacement patterns", only[node:menu-link:parent:url]But this works perfectly nevertheless:
[node:menu-link:parent:url:path]/[node:menu-link:title]Comment #20
BrianLewisDesign commented[node:menu-link:parent:url:path]/[node:title] -- this repeats the top level parent multiple times, for nth children in the menu. makes a mess. doesn't get the full heirarcy.
[node:menu-link:parent:parent:parent:parent:url:path]/[node:title] -- this gets the top parent only, with no repeats, down to the 4th child in the menu.
[node:menu-link:parents:join-path]/[node:title] -- perfect. this gets the whole parent menu hierarchy into the URL. that's what i was after.
Comment #21
mustanggb commentedComment #22
kevinquillen commentedHow well does this work?
Comment #23
mario.awad commentedIt works perfectly. However, I think it's more correct to use the following one as it uses the menu link instead of the node's title (which can be different or similar depending on the user's choice).
[node:menu-link:parents:join-path]/[node:menu-link]
Works very well under:
Drupal 7.14
Pathauto 7.x-1.1
Token 7.x-1.1.
Cheers.
Comment #24
m4rinos commentedMarvelous mario.awad! #23 solution works great!
Comment #25
georgemastro commentedYou can also try my solution http://drupal.org/sandbox/georgemastro/1929944
Comment #26
stephesk8s commented[node:menu-link:parent:url:alias] worked well for me to add the correct parent menu path to Custom Breadcrumbs. Without :alias, it was giving the domain twice i.e. website.com/website.com/parent-path. The :alias option was not in the Placeholder Tokens list but worked. Thank you for posting.