3

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?

3

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???

  • oups wrong post... – anou Nov 19 '13 at 20:25
2

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.

  • 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 '13 at 10:16
0

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');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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