Given this situation:

foo/bar -> node/56 <- bar/foo

If I assign "foo/bar" in a menu, I get a message back saying aliases are not supported, and the link is re-written to be "node/56". All well and good. This also happens when I assign "bar/foo" in a menu.

However, the URL alias used as display will *always* be "foo/bar". Never "bar/foo"

I have made changes to two files:

  • modules/menu/menu.admin.inc
  • includes/menu.inc
  • that will now allow aliases in menu items: Could someone review these changes, and tell me why what I am doing is wrong?

    Thank you in advance!

    - Tony Herrig

Comments

uotonyh’s picture

StatusFileSize
new2.23 KB
new4.37 KB

Noticed that the menus were not expanding correctly on the page using the alias: So, I modified function menu_tree_page_data in includes/menu.inc to parse the query string, and pass it into the query that looks up URLs in the menu tree.

Thanks again in advance!

harking’s picture

This is related to http://drupal.org/node/161575 in which they added the code for the conversion to node/#.

We'll need more information from the core developers as to why we shouldn't store node aliases in the menu system.

harking’s picture

One solution would be to add a "Don't convert this URL to a node/# form" checkbox to each menu item. This could also be ported back to Drupal 5.

I'll write up a patch. This would need quite a bit of community feedback since _everyone_ uses the menuing system.

pwolanin’s picture

Status: Needs review » Closed (works as designed)

I'm not sure I understand the motivation here. It's generally considered confusing and bad SEO to have multiple aliases to the same page. If you find it important to link to a particualr alias, you can put in a full path (eg. http://...) and it will always be used as-is. Without a compelling reason to look at this change, I'm marking it "by design".

The link path needs to be valid in order to derive the router path, and hence to do access control on the links. This is a major difference form Drupal 5, where access to node and related links was not implemented, so a link to a node that user could not access would still show up in the menu.

Note also, if you were storing path aliases, you would have to set 'alias'=>TRUE in the options, and we'd have to add a bunch of code to keep checking this and whether we have a real path or not. If the alias was changed or removed, then the link would break - which I would think is a more serious problem.