-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error 404 in modern routing for links without own menu item (NomenuRules) #19280
Conversation
Quite large PR, congrats. I've tested with a copy of a customer site on my PC. At a fist glance the links do not have the IDs anymore which is good, and 404 are gone. I've a draw back for Links displayed via Modules . In my case the links are displayed via the Joomla Custom Modules in position Right using the popular 3rd party extension https://www.regularlabs.com/extensions/articlesanywhere . I can reproduce without the 3rd party plug-in using the "Modules: Articles - Newsflash" once le links are clicked they are loaded in the "main" position. At this point this is B/C the Modules in Right position do not load anymore using Menu Assignment "Only on the pages selected" as we lost the menu "context". |
So it is success test.
In general, this is unrelated to this PR. I understand that you complain, that before you have (invalid - from my perspective but) working link like '/menu-category-a/category-alias-b/articlealias' but now you have If there is no menu item then only modules with setting "On all pages" (and IIRC On all except selected) will be displayed. Ex, if you see link to article like |
Correct that is the reason I mentioned B/C
You are correct again and worth mentioning the menu item need to be Published otherwise it won't work. In my specific case if this PR is accepted, I'll end-up creating 3-5 extra menu and editing 20+ modules to have the same user experience. On the positive note, SEO and sitemap will be enhanced. It breaks my site and I can deal with that, so can break others. I'll vote for this PR subject to super-duper assessment. Updated formatting. |
To be clear, mentioned issue about B/C is related to already merged PR #19099, not to this one.
Yes, this should be done earlier in you website but earlier joomla allows to missing menu items and put there (in link) menu items from other contents. The problem was hidden. Ex. if you had 2 different categories ( The new way does not borrow the menu item from previous page, which created a lot of duplicate contents in Google.
After you add a few menu items then you can assign the old modules to them. That all. |
I'll update the site accordingly. |
@jsubri Please mark your test result here: https://issues.joomla.org/tracker/joomla-cms/19280 |
I have tested this item ✅ successfully on 0fb789d This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19280. |
Hmm, I don't have a good feeling with this. From my perspective, this is not backwards compatible. it changes existing URLs from released versions of Joomla, so if we honour our dev guidelines and our commitment to backwards compatibility, we can not change this in this way. A way to make this backwards compatible would be to add a nomenu2 rule and a switch in the components where you can switch between the different behaviors, like we have with modern and legacy routing. Besides that, I would also ask you to change your unittests. The fact that you had to change the unittests in this way, shows that this is a break in B/C. The tests in this PR do not test the same as they did before and prior tests would fail. You are also using sample data from the database, which I would consider to be bad practice, and instead have the test-data be part of the test-suite. |
We have at least six routing rules for SEF:
This PR breaks B/C (error 404) for rule 5 (only one example below), which has been using rarely. I wrote this PR to fix rule 6, which is completely broken. Examples of 5 and 6 rule before and after PR:We can start at Before PR (Remove IDs is OFF - rule 5)Build and parse:
Before PR (Remove IDs is ON - rule 6)Build ok and the parser results:
After PR (Remove IDs is OFF - rule 5)Parse old links:
Build and parse new links:
After PR (Remove IDs is ON - rule 6)Parse old links, which does not work before:
Build and parse new links:
|
I understand that. However, a break in B/C is a break in B/C. The broken behavior in rule 6 is indeed something we need to fix and I'm currently considering if we can switch off removing the ID for that router rule. That would be extremely dirty in my book... I don't know the right solution for that right now. The other change in behavior however is not really acceptable. Either we stick to our B/C claim or we don't and it would be extremely hypocritical if a change like this now would be handled differently than the router modernization efforts before this. |
For modern routing I'm not convinced to be B/C at this issue. IMHO we can use an exception to fix the real problem, I only put my solution there. I'm waiting for better solutions. If we do not fix it at the beginning, the problem of rule 6 will grow. Please do not leave people with choice:
|
OK
IMO there will be too many switches but If others agree I can do it. |
I have tested this item ✅ successfully on 614dda6 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19280. |
@jsubri can you please retest? |
My test is for single language website only. |
I have tested this item ✅ successfully on 614dda6 IMHO, due to #19099 and #19280, 3.8.4 shall probably advertised as a bit more than a simple patch for the ones using the Modern Router. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19280. |
Ready to Commit after two successful tests. |
Has someone tested this with multilingual? |
My initial test was on multilingual, today was English only (Sample site). Given the potential impact with such PR, addl testers can’ hurt as we had recent changes in the languagefilter. |
Why did you close this one? As I was integrating the new router in DPCalendar I was confronting with the same problem when there is no menu item available. I had to do some dirty hacks to get rid of the 404 error in DPCalendar. There is an alternative approach which contains the id in #20117. But from a quick glance this here is the logical way. I mean how can a fix for an invalid url which leads to an invalid 404 be a BC break? I'm reopening it, as this bug needs to be fixed in J3. |
I have tested this item ✅ successfully on 614dda6 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19280. |
Ready to Commit after 3 successful tests. |
:) This PR has a one weakness, it breaks B/C in only one case, but we can add a workaround for J3. This comment is about parsing an an old links if Remove IDs is DISABLED. for modern routing. Subject: To test issue please create a tree of categories:
Before PR go to: After PR the above link won't work, Joomla will build a new one, the correct will be: On your test, you can ignore language prefix. To support B/C, we can scan all categories and find the correct ID, (ex: for 10-dachshund). |
For me it is not a BC break when such an obvious bug is fixed. In the release announcement we need to add then a special note. |
Can we push it forward until not many people use it? |
Maintainers feel a bit hesitant to ship it with a patch release. So I changed the base branch to 3.9. @mbabker your turn here :) |
Thanks @laoneo, 3.9 is great. |
Bug or not it still creates a B/C break as pointed out. And that's the reason I've been hesitant on hitting the merge button, this isn't "just" fixing some bug, it has user facing impact because it changes URI structure (even if the outcome is what is desired) and inherently changes what routes can be parsed and routed correctly. |
We can try to add solutions like:
|
Personally I don't like either one of the options. It just seems like it's asking for trouble. But so does blatantly merging something that everyone acknowledges is a B/C break. |
Is there any decision from maintainers about what to do with this PR? Should I move it to 4.0-dev branch or close it and we will wait for a better solution? |
Because I am not aware of the decision what to do next with this PR, this week I will try to move this PR to 4.0. |
Closing in favour of PR #20979 |
Summary of Changes
When there is no menu item for category/categories/article view in com_content and option
Remove IDs
is enabled then a link like:/index.php/en/component/content/article/article-en-gb?catid=8
returns error 404In this PR I rewrote
NomenuRules
class tobuild
andparse
links:index.php/en/component/content/article/category-en-gb/article-en-gb
(optionRemove IDs
is enabled)index.php/en/component/content/article/3-category-en-gb/2-article-en-gb
Testing Instructions
Disable all menu items for
com_content
categories/category/article
views.Go to frontend
index.php/component/content/categories
and check links to category and article items.Expected result
Links work, no 404 when option
Remove Ids
is enabled/disabled.Actual result
When option
Remove Ids
is enabled then links to articles return error 404.