Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I know that having multiple path aliases to a single node is discouraged, but it is a situation I have to deal with.

My node is accessible via /news/node-1, /baseball/news/node-1 and /basketball/news/node-1. It's the same node, just three different aliases.

I have a 3 menu blocks, only 1 of which should be shown at any given time. I've configured the Page restrictions on the blocks so that the are restricted to certain url path patterns.

The "baseball" menu is restricted to baseball/*, the "basketball" menu is restricted to basketball/* and the 3rd menu is everything else, so I've set it to show on all pages except for baseball/* and basketball/*.

However, my problem is that when I'm browsing to baseball/news/node-1, the 3rd "everything else" menu is the one being shown. My -guess- is that drupal is looking behind the scenes and seeing that the node is also considered to be /news/node-1 and therefore the path being used to choose my menu block is choosing the 3rd "everything else" menu.

a) is there a way to see what path drupal is using when determining which blocks to show based on path?

b) is there a hook I could implement so that I can directly control which block to show on each request?

c) any other ideas how I can make sure the correct block is shown?

share|improve this question
I think it's a little more base/core than that in that these nodes are really still node/# and the block system uses that system path for restrictions, not the alias(es). – Jimajamma Jun 6 at 1:07
The page restrictions on the blocks definitely respect path aliases. – Kenny Wyland Jun 6 at 1:14
add comment (requires an account with 50 reputation)

1 Answer

Try setting the baseball menu to show on baseball/* and baseball/*/*. Likewise for the basketball menu, then set the Everything Else menu not to show on all four paths.

share|improve this answer
I had high hopes this might work, but alas, no. I tried it and the Everything Else menu still shows when I browse to /baseball/news/node-1 – Kenny Wyland Jun 6 at 3:04
Have you tried baseball/news/* ? – Triskelion Jun 6 at 3:11
I haven't, I figured that should have been caught be either baseball/* or by baseball/*/* but I'll go try that right now. – Kenny Wyland Jun 6 at 3:13
Alas, no, that didn't work either. :( – Kenny Wyland Jun 6 at 3:16
I finally found a way to get the path it thinks it is showing and it still thinks it is showing /news/node-1 even though that's not what the current url is in the browser. – Kenny Wyland Jun 6 at 3:20
show 7 more commentsadd comment (requires an account with 50 reputation)

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.