No Code Attached Yet
avatar BillyGeat
BillyGeat
14 Nov 2024

The closed issue #43324 (Menu link URL to an in-page anchor ( ...#some-id) not working from a submenu) is not fully solved in Joomla 5.2.1.

If you add an anchor link to a page that is under a sub-menu, the resulting link does not work (error 404) as it is wrong created.

When the link is like https://website/article1 ("article1" is the Alias showing under the menu item in the administration) then the resulting link https://website/article1#jump-to-2 works.

But if there are sub-menu items like https://website/products/product1,
it does not work because the resulting link is then like this

https://website/product1#jump-to-3
instead of the correct one
https://website/products/product1#jump-to-3

The link in the menu is created as "System Links -> URL" and the link then is added as "product1#jump-to-3" (where "product1" is the Alias from menu administration again).
Adding something like "products/product1#jump-to-3" does only work if SEF URLs are activated and working (not always the case on some environments).

avatar BillyGeat BillyGeat - open - 14 Nov 2024
avatar joomla-cms-bot joomla-cms-bot - change - 14 Nov 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Nov 2024
avatar Hackwar Hackwar - change - 19 Nov 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-11-19 07:59:36
Closed_By Hackwar
avatar Hackwar Hackwar - close - 19 Nov 2024
avatar Hackwar
Hackwar - comment - 19 Nov 2024

I'm sorry, but that is expected behavior. You are using a relative URL and as it seems, you are expecting by simply referencing just the alias of something, you'd have a complete URL. Both unfortunately is not true. First of all, if you are using a URL which is not processed by the Joomla routing system (e.g. a URL starting with index.php?option=) you have to use absolute URLs, starting from the root of the domain, for example /product1. And besides that, the router expects a full URL path, like you described yourself: /products/product1. Since this is not a bug in Joomla, I'm closing this issue.

avatar BillyGeat
BillyGeat - comment - 19 Nov 2024

OK, I thought, the alias is something like a unique identifier (from what I understood here: #43324 (comment)), because it works for "flat" menu structures.

So as it looks now, there is no way to have anchor links in sub menus that work in both cases, with activated and not activated SEF URLs.

avatar Hackwar
Hackwar - comment - 19 Nov 2024

There are numerous ways, you can use the non-SEF URL with Itemid or you can just use the non-SEF URL consisting of just the Itemid, depending on what you want to do. But normally you wouldn't switch between SEF and non-SEF URLs.

avatar BillyGeat
BillyGeat - comment - 19 Nov 2024

Yes, this is true, when it works with SEF URLs (best and wanted case) there is no need to switch between them. My issue was, that I had SEF URLs in my dev environment but on the prod server didn't work (then, but solved now). Thank you!

Add a Comment

Login with GitHub to post a comment