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

On Drupal 7, there is a difficulty adding two or more items to a menu which are having the same URL but a different query string.

For example, when I add two similar paths:

  1. node/add/alert?kind=regular
  2. node/add/alert?kind=news

Only one of the links is randomly displayed. So frustrating...

Any ideas of how to by bypass this issue?

share|improve this question

3 Answers

What I did is add the redirect module.

Then I created custom redirects for those menu items, e.g. "node/add/alert/kind/regular" goes to "node/add/alert?kind=regular".

No need for custom hook_menu programming. It worked! But why doesn't drupal provide it work out of the box???

share|improve this answer

Another option would have been to make a custom Block in Drupal with your 2 links as simply an HTML list.

So far as I know /node/add/alert is 1 page in Drupal, Pylons, Joomla whatever .... its 1 page path to Apache or Nginx. The querystring is simply key-value pairs of arguments you are passing to the page.

The default Menu system in drupal doesnt allow for a single page to exist in more than 1 spot of your site (see NodeSymlink for a module that allows an alias of a page to live in different places of your site, but only 1 master location for the content).

I believe what you're seeing here is an example of drupal's 1 piece of content, lives only 1 place in drupal; so disallow multiple links to the same thing for SEO purposes.

share|improve this answer
Custom block was not an option - I had to put those links in the drupal admin_menu module which uses a standard drupal menu. – Druvision Apr 26 at 10:16

Not quite with Drupal, but you can add a bit of jquery to target the menu item id.

In your menu item, set the path to "" as a placeholder.

Then add this bit of jquery:

$("a#specificLink1").attr('href','/node/add/alert?kind=regular'); $("a#specificLink2").attr('href','/node/add/alert?kind= news');

share|improve this answer

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.