No Code Attached Yet bug
avatar apaulo
apaulo
23 Sep 2023

Steps to reproduce the issue

Having the following menu entry:
ID: 524
Type: Articles->Create Article
Link: index.php?option=com_content&view=form&layout=edit

Execute: echo Route::_('index.php?option=com_content&view=form&layout=edit');

Expected result

  • a SEF-friendly URL path according the Joomla menu structure (v.g. /articles/add).

Actual result

  • Un-friendly URL path: /component/content/form?layout=edit&Itemid=101 (Itemid 101 refers to the home menu entry).

Additional comments

Execute echo Route::_('index.php?Itemid=524'); and it returns the expected result

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
4.00

avatar apaulo apaulo - open - 23 Sep 2023
avatar apaulo apaulo - change - 23 Sep 2023
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 23 Sep 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 23 Sep 2023
avatar robbiejackson
robbiejackson - comment - 25 Sep 2023

This sort of thing seems to be a common problem, considering the number of recent related problems on Joomla stack exchange, eg:

I believe that at least part of the problem stems from the router preprocess() function which (as far as I can see) doesn't attempt to find the best match between

  • the view/layout etc parameters in the Route::_() call and
  • the associated view/layout etc parameters in the menuitem.

In other words it seems to go with an Itemid if the component associated with the menuitem matches the option= parameter of the Route::_() call, but doesn't seek to match on other parameters such as view or layout. Those other parameters then need to get included by adding them as query parameters to the URL instead.

I think that it's important that SEF URLs are not only functional (in that they get you to the right page), but also aesthetically pleasing (rather than looking awkward with additional &view=...&layout=... parameters, which in this case could be avoided if the best menuitem was chosen).

(The router has changed from Joomla 3 to Joomla 4 in this area, and it has caused some issues for people who have had printed material produced which quoted the old URLs, or links from other sites. And there doesn't seem to be any Joomla configuration that can maintain the previous URLs, or govern what gets generated as the SEF URL.)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41897.

avatar Hackwar
Hackwar - comment - 14 Mar 2024

Can you check if #42989 improves this for you? It wont entirely fix it, but provide a slight improvement hopefully.

avatar Hackwar Hackwar - change - 24 Mar 2024
Labels Added: bug
avatar Hackwar Hackwar - labeled - 24 Mar 2024
avatar Hackwar Hackwar - change - 30 Mar 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-03-30 17:59:00
Closed_By Hackwar
avatar Hackwar Hackwar - close - 30 Mar 2024
avatar Hackwar
Hackwar - comment - 30 Mar 2024

Since we have #42989, I'm closing this issue.

Add a Comment

Login with GitHub to post a comment