More flexible menu items

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
rhouse's picture

I have run into a limitation with the processing of menu items. If I enter a URL into the link, such as "about" (where I have a page with URL "about"), then the system replaces this with something like "node/8". That is problematic because I entered a logical reference and ended up with a physical reference (which is always inflexible design). So if I replace my about page later with a fresh one that has a different node number, then I have to go through all the menus looking for items that referenced about, and re-entering "about" or entering the new node number. This seems to be an unnecessary problem. The processing of menu items could obviously be altered to fix this (i.e. to retain specified logical information) without impacting existing functionality. (After all, if I want node/8, I can always ask for it specifically.)

Comments

Turn on the Path module

earnie@drupal.org's picture

Turn on the Path module and install http://drupal.org/project/autopath. Then your problem will go away.

Slight correction, it's Pathauto.module

Senpai's picture

Earnie mistakenly snapped the wrong link up above. It's http://drupal.org/project/pathauto.
______
Senpai


Joel Farris | my 'certified to rock' score
Transparatech
http://transparatech.com
619.717.2805

Sorry about that. Yes,

earnie@drupal.org's picture

Sorry about that. Yes, pathauto is correct and too bad I can't edit the comment (after a reply) like I can in the project issues.

Edited.

Thanks but puzzled

rhouse's picture

Many thanks for the suggestion, but how exactly will that solve my problem? It seems to be a module concerned with auto-generating the aliases. It doesn't (or it doesn't say it is) change anything about how menu items refer to aliases once they have been generated (whether by hand or automatically). What improvement in the situation will I see if I install this module? And how does it restore the flexibility I am suggesting should be there by default? Isn't that just papering over a bad decision?

The module will display the

earnie@drupal.org's picture

The module will display the links based on the format you give for the alias and will replace (dependent on configuration) an existing alias if you create a new About page with a new node/<nid> rather than editing the original (which is what I would do). Then your hard coded links can refer to the alias (e.g.: /about) instead.

I don't think that solves the problem.

rhouse's picture

I realIy appreciate your help here, but I don't think that solves the problem. The trouble is in the menu item code. No matter what you type as the URL in menu items, the core system replaces it with a hard-coded node/x. No matter how convenient you make the process of allocating nice names to nodes, the menu item will not have the name in there, even if you enter a name when you make the menu item. It will have a node number, and changing names around will just make the menu show the wrong name, it will not make it redirect to the new location of the same name. The point is, yes, I can change my own hard-coded links in page content to names (in fact I never put hard-coded links in my content in the first place) but I can't stop the core replacing my names in menu items with hard-coded links. It does do this and it is IMHO clearly an incorrect usability decision.

I think this is not a problem of making allocation of node names convenient. Unless the pathauto module goes through the database looking for node/x - type entries that referred to an old page for a name and replaces them with node/y where y is the new node for the same name (which I very much doubt it does), I cannot see how it solves the problem at all. And even if it did, surely expecting a third-party extension to correct a core problem is ignoring the usability issue?

Thanks again for your help!
Ron.

There could be a solution

eigentor's picture

If this is about links you put into the content, there could be a solution. You can use the module Linkt to content http://drupal.org/project/linktocontent. Given that you use TiniMCE or FCKeditor, it gives you a dropdown selector that lets you put a link to any node - browsing by Taxonomy or menu (also by Categories if you use Category Module) through all existing nodes. Typolight http://www.typolight.org/ http://drupal.org/project/linktocontent (Video is in german) does this in a similar way.

Last time I used this, the link you insert was automatically named after the node title (there were some usability issues to sort out: can the user change the naming of the link or not and stuff).

But apart from that: Drupals internal system that keeps track by node numbers instead of Names is very good and superior to an only name-driven Linking.

Because: often you change a node title, but you want all links to that note be kept intact. So internally it needs an unchangeable reference to that node, which is the node number. So much for the internal technical stuff. The Display of the link is another thing which can be and is handled in a different way. A menu item is a freely defined name for that, a node Title would be a different one.

The case you specified is not really something that should present a problem: the one who creates the second "About" page cannot expect that links remain intact when he puts in a different page for "about". It will happen in 80% of the cases (I presume) that someone changes the existing "about" page, like earnie already mentioned. If people have experience in Web publishing, they know that links link to items of content, and if you want to link to a different item of content, you have to make change the link.

Life is a process

Life is a journey, not a destination

Thanks Eigentor, but no it's

rhouse's picture

Thanks Eigentor, but no it's NOT about what I put into my content. To say it again, it is specifically and ONLY about making menu items with the core menu system. Go to any menu and click "add item". Now in the path field, type, say "contents" (assuming you have a page called contents). Click Save. Now click Edit next to the freshly created item. The path field will not show "contents", it will show something like "node/351". That is replacing logical information with physical information, and that is a bad design decision. No talk about how I name my nodes will fix that flaw. If I have links to "contents" in every menu and I replace my contents page with another under a different node number, I have to locate every menu item that referred to the old contents page and make it point to the new one.

In any context I can think of, this is a bad design decision, your comments about node names changing when the title changes notwithstanding, because that presumes I use some system of automatically assigning node names. I need not do so. I can assign them manually when and only when I want a fixed symbolic reference to a conceptual page as opposed to a physical page. Think of a corresponding situation in programming: I name a constant symbolically, but when I compile my program the compiler runs an editing job on my source code replacing the name with the actual integer value. Would anyone seriously argue that such a thing is other than intolerable? How is this any different?

If the menu code did not do this, I could use a physical reference like node/351 when I want to refer to a specific node, and I could use a logical reference like "contents" when I want to refer to a conceptual target. I cannot make sense of your final two paragraphs. The first talks about unchangeable references. So? Use node/xxx. I don't. When I write a URL, I expect that it should point to the page I want to have that name, not to a page that used to have that name in antiquity. You have node/xxx to do what you want, I want symbolic names to do what I want. Seems fair. Then you say someone making a second about page can't expect links to remain intact. Why on earth not?? If they were left as they were written instead of being forcibly tinkered with, they would ALL remain intact, just as the links in my main content all continue to work because I use symbolic names when appropriate.

Cheers,
Ron.

I agree it is confusing. I

yoroy's picture

I agree it is confusing.

I think if you want to know the how and why of this, you'd be better off creating an issue here: http://drupal.org/node/add/project-issue/drupal (choose "menu system" as the component).

I agree with yoroy

earnie@drupal.org's picture

Be sure to put a reference to this comment in the issue and make the title clear enough so that it is understood from the title that the issue is the path alias URL being replaced with the physical URL.

Thanks guys, I'll do just that.

rhouse's picture

Thanks guys, I'll do just that.

How to display page specific menu item

farhat_naz's picture

Hello Guys,
I have a menu with different menu items.
I want some of the menu items should be displayed on specific pages and some must not be displayed.
How can i do that.
I need urgent reply.
Thanks in advance

Usability

Group organizers

Group categories

UX topics

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week