joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

RFC When saving a menu item type system > menu alias could the alias be automatically created rather than manually?

Open uglyeoin opened this issue 1 year ago • 26 comments

Problem identified

Creating a system item alias and hitting save errors saying the alias already exists if the menu item has the same name as the original. As it goes to the same place this could be quite common.

Proposed solution

Menu item either saves manually if entered, but if not entered saves as the same name with "-alias" appended.

Open questions

I might event be able to code this (he says wistfully). But I won't do it if there's a reason not to.

uglyeoin avatar Feb 13 '24 22:02 uglyeoin

Do you mean that if the alias is not entered, the system adds - to the alias in this way? "i use joomla 4" Screenshot 2024-02-18 182929

TheNourhan avatar Feb 18 '24 15:02 TheNourhan

I don't understand the request. Please provide exact steps to reproduce. Thanks.

Quy avatar Feb 19 '24 18:02 Quy

It was a RFC. I clicked that button but I guess it's not clear.

Create a menu item. It creates an alias, unless one of the same already exists. Then I have to create one. This makes sense.

I create a system > alias. It creates an alias, it already exists, but the alias for a system alias is never used. Or have I got that wrong? I assumed it just used the URL of the original menu item.

Therefore, it doesn't actually matter what it is. If that's the case, let's just do this automatically for the users. And possibly even disable it altogether (although I don't often advocate for that and I bet some users have a reason for not doing that).

I'm suggesting we just do "menu-name-with-hypens-alias" as the alias. But you may well tell me I'm way off the mark.

uglyeoin avatar Feb 19 '24 18:02 uglyeoin

Is this about Separator and not Menu Item Alias?

Quy avatar Feb 20 '24 19:02 Quy

It's about menu item alias AND it's about creating the alias for the menu item alias. Does that make sense? Or do you have other questions perhaps that I can help to clarify what I mean?

uglyeoin avatar Feb 20 '24 19:02 uglyeoin

@uglyeoin I get it.

When you create a menu item (any type) and save, then an alias is created unless it already exists in which case you are prompted to manually create an alias. image

What I believe @uglyeoin is suggesting is that instead of being prompted to create an alias manually it is automatically created with (perhaps) a number added to the alias. Which is the behaviour when you save an article

image

brianteeman avatar Feb 20 '24 19:02 brianteeman

I'm sure it's me being uneducated, but I don't see the point in an alias for the system > alias at all. Surely it will always use the alias of the original article. So I wouldn't mind if it added a number, or even some gibberish if it's never used. But I'm guessing I'm wrong and it can be used somewhere

uglyeoin avatar Feb 26 '24 20:02 uglyeoin

you could tell someone to type in the url or create a link to the url

brianteeman avatar Feb 26 '24 20:02 brianteeman

I see. I guess that could be useful to create shorter links. Could also be achieved with the redirect plugin.

uglyeoin avatar Feb 26 '24 20:02 uglyeoin

Aliases are used by Joomla to make Search Engine Friendly URLs so auto appending -alias or a number is probably not preferred. Sorry I am still not understanding the request/issue.

Quy avatar Feb 27 '24 01:02 Quy

@Quy I guess he is talking about System Links -> Menu Item Alias menu item type when creating menu item.

joomdonation avatar Feb 27 '24 01:02 joomdonation

I understand and I am too. The alias value will be part of the URL so I am trying to understand why you would want to append -alias or a number in the URL instead of a custom value.

Quy avatar Feb 27 '24 02:02 Quy

Mmmh, in the case of a Menu Item of Type "System > Alias", the "Slug" (sorry to use such a bad word here, I wanted to avoid the word Alias since it is ambiguous in the current context) is completely useless, isn't it?

What I mean is: if indeed the "Slug" is not used anywhere (in any URL or whatever) then

  • the question is not how it is filled in (automatically or not)
  • but the question is why even display and save it

woluweb avatar Feb 29 '24 15:02 woluweb

you could tell someone to type in the url or create a link to the url

brianteeman avatar Feb 29 '24 17:02 brianteeman

I am not sure if it is intended but if I create a "menu item alias" and set the field alias to "myShorUrl" I can access the connected menu item with /myShortUrl. This will then create dublicated content because the same content is available under two different URLs. I am pretty sure some has used this as a trick to make shorter URL. My personal view on this is that it is a bug and the alias of a menu item alias should not be used at all and we should not require that it has to be set.

rdeutz avatar Apr 27 '24 10:04 rdeutz

No it does not create duplicate content.

Here is a real world example. I have a top level menu item with as "myShorUrl" that is an alias to a sub-level menu item If I type the "myShorUrl" I am redirected to the sub-level menu item

image

If you visit the alias in your browser (https://www.sinaileeds.uk/agm-2024) You will be redirected to the actual menu item (https://www.sinaileeds.uk/news/sinai-agm-2024)

brianteeman avatar Apr 27 '24 13:04 brianteeman

The thing is, you can also achieve this with redirects. The difference being with redirects you would get information on the number of hits. So I believe that should be the recommended method. Is that everyone else's opinion? Or is there a different opinion? I understand this would be a breaking change for some people who use Brian's method (which is perfectly valid).

uglyeoin avatar Apr 27 '24 15:04 uglyeoin

I have tested this with the blog sample data and made a alias to the love article with the alias blog0815 and I get the content of the article when I add /blog0815 to then home url. There might be a different settings, but at my site it is as I wrote

rdeutz avatar Apr 27 '24 15:04 rdeutz

The thing is, you can also achieve this with redirects.

There are always multiple ways to achieve everything

The difference being with redirects you would get information on the number of hits.

Using redirect manager to measure hits is a strange way of working as it only tracks a small % of the hits to your site. Surely if you care about such things (I do not) then you would use a real counter

So I believe that should be the recommended method. Is that everyone else's opinion? Or is there a different opinion? I understand this would be a breaking change for some people who use Brian's method (which is perfectly valid).

Recommended or not it would be a breaking change and the only benefit would be that occasionaly when creating the alias you have to go a step further than normal

brianteeman avatar Apr 27 '24 17:04 brianteeman

I have tested this with the blog sample data and made a alias to the love article with the alias blog0815 and I get the content of the article when I add /blog0815 to then home url. There might be a different settings, but at my site it is as I wrote

you have misunderstood the issue but thats fine. ITs not relevant to the reported issue

brianteeman avatar Apr 27 '24 17:04 brianteeman

Recommended or not it would be a breaking change and the only benefit would be that occasionaly when creating the alias you have to go a step further than normal

Actually I think the benefit would be that users receive a confusing error message. I think it's a usability issue and it makes the system "seem" less well built. But I agree it's a minor issue and very likely often unused future by newer users. It would be difficult to argue for removal. It would be easier to argue for functionality that automatically does something to save it and then reports that e.g. we've added a 1 to the end of your alias as it already existed, or we have added the word alias in front of your alias as it already existed.

uglyeoin avatar Apr 27 '24 18:04 uglyeoin

I dont disagree with that and I already said I agree https://github.com/joomla/joomla-cms/issues/42811#issuecomment-1954936697

brianteeman avatar Apr 27 '24 18:04 brianteeman

The change I was against was your suggestion that redirects were used instead

brianteeman avatar Apr 27 '24 19:04 brianteeman

The redirects bit I hadn't realised were so unreliable. But I would still argue it's better practice. But I wouldn't argue strongly because I don't really care enough and there's minimal benefit lol

uglyeoin avatar Apr 27 '24 19:04 uglyeoin

We discussed this yesterday in the weekly maintainers meeting. We agree we should make this more consistent, but this is one of the things we want to look at when we fix some of the router issues we have.

rdeutz avatar May 09 '24 11:05 rdeutz

Thanks for discussing & feeding back @rdeutz it is appreciated. Feel free to close or merge this "issue".

uglyeoin avatar May 13 '24 11:05 uglyeoin