User tests: Successful: Unsuccessful:
Pull Request for Issue #40454.
When running in multilanguage mode, the router falsely only checked for the current language or the default language, not for all (*
) language when looking up the right Itemid. This executes the logic twice, once for the current language, once for the *
language. It exits for the first matched menu item.
URLs start with /component/tags/...
URLs have different menu items. None start with /component/tags
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Category | ⇒ | com_tags Front End |
Status | New | ⇒ | Pending |
I have tested this item
Test site with 3 languages installed (sample data) and pagination for one of the tags
With published menu item /component/ not present
Without published menu item /component/ not present
in either case no itemid
Labels |
Added:
Release Blocker
bug
PR-4.3-dev
|
I have tested this item
I have tested this item
The links on the Homepage below in Popular Tags (after index.php)
Joomla 4.2.9 before Tagged-content Menu Language en-GB
/en/component/tags/tag/millions-en-gb /en/component/tags/tag/worldwide-en-gb /en/component/tags/tag/love-en-gb /en/component/tags/tag/joomla-4-en-gb
with Tagged content Language Menu en-GB with Tags 'Millions' 'Love', tagged-content within 'Millions' and 'Love' (tagged in Menu)
/en/tagged-content/millions-en-gb /en/component/tags/tag/worldwide-en-gb /en/tagged-content/love-en-gb /en/component/tags/tag/joomla-4-en-gb
after Joomla 4.3.0 - component and itemid
/en/component/tags/tag/millions-en-gb?Itemid=104 /en/component/tags/tag/worldwide-en-gb?Itemid=104 /en/component/tags/tag/love-en-gb?Itemid=104 /en/component/tags/tag/joomla-4-en-gb?Itemid=104
after applying Patch 40474 - itemid gone but still with component
/en/component/tags/tag/millions-en-gb /en/component/tags/tag/worldwide-en-gb /en/component/tags/tag/love-en-gb /en/component/tags/tag/joomla-4-en-gb
@Hackwar Shouldn't the $language
be changed to $lang
in lines 131 and 138 as those come below the for loop?
joomla-cms/components/com_tags/src/Service/Router.php
Lines 131 to 138 in 18d024d
Indeed, that needs to be changed.
done
Btw. The testing instructions above are missing the step to setup a menu item with the tagged items in en-gb between steps 5 and 6 (on my test site the menu item has the alias 'tagged-content' as the links for 4.2.9 show) and if this menu item is set to language 'all' the links will stay on 'component' - this may be a clue.
To be more clear, the issue here is that if you create a menu item to link to Tagged Items menu item type and select two tags A and B :
There was changed to the logic of code to find active menu item for a tag for some reasons. Unless the tagged items menu item type only select a single tag, it won't be used for link to a tag like before.
Indeed, the lookup was changed, since the old code was unable to find menu items with more than one tag assigned to them. So if you created a URL with 2 tags, it couldn't find a menu item at all. Fixing that now results in menu items with multiple tags not matching to URLs with a single tag. I personally think that tags are a filter on the content and those filters compound, so a URL with two tags should only display the content which has both tags assigned to it, but apparently I'm wrong there, since the tagging code doesn't behave that way later on in the model.
I will change the code to match it again.
Done.
I have tested this item
The last change seems to do it for me:
Tags that are associated to menu items are properly opening in that menu item (use of the alias of the menu item),
Tags that are not associated to menu items open in the home page (/component/tags/tag in the path).
Behavior is consistent to 4.2, no longer dimmed as b/c as far as I can tell.
Hello @tramber91, could you take a shot at this PR and see if it addresses your issues? Merci beaucoup!
@obuisard
I have tested the file (copy raw) unfortunatly same result on my side
https://biomecanique.en-toutes-lettres.fr/fr/carte/cartographie-labo-formation/81-laboratoires-de-biomecanique/382-auctus-inria-ims
Not working, same as previous file
There is indeed something still wrong.
I have created a site with 2 languages, "en-GB" and "de-DE", and have installed multilingual sample data and then for each of the languages blog sample data (this is possible when switching administrator language so you can install blog sample data for each language.
Then I have created a menu item of type "Tagged Items" in the Main Menu (de-DE). That menu item has language "de-DE" and has 2 tags "Millions (de-DE)" and "Love (de-DE)" in its tag field.
I've done that on a site created with the 4.2-dev branch and on another one with the branch of this PR.
When comparing both sites, I notice following differences in the "Popular Tags" module shown at the bottom, which shows tags for both languages:
alias-of-the-tagged-items-menu-item/alias-of-the-particular-tag
, e.g. https://www.joomla-42-dev.vmubu01.vmnet2.local/index.php/de/test-tagged-items-menu-item/millions-de-de
, and all other tags have URL with the component/tags/tag/alias-of-the-particular-tag
scheme, e.g. https://www.joomla-42-dev.vmubu01.vmnet2.local/index.php/de/component/tags/tag/millions-en-gb
.alias-of-the-tagged-items-menu-item
when I am on a page with language "de-DE", which is the same language as the "tagged items" menu item has and the 2 tags have. E.g. https://www.joomla-43-dev.vmubu01.vmnet2.local/index.php/de/test-tagged-items-menu-item
./alias-of-the-particular-tag
is missing at the end.component/tags/tag/alias-of-the-particular-tag
scheme, e.g. https://www.joomla-43-dev.vmubu01.vmnet2.local/index.php/de/component/tags/tag/millions-en-gb
.alias-of-the-tagged-items-menu-item
. The tags which are in the tagged items menu item have nothing else after that part of the URL, and the other tags which are not in that menu item have the tag ID behind that, e.g. "https://www.joomla-43-dev.vmubu01.vmnet2.local/index.php/de/test-tagged-items-menu-item/2".So we still have 3 issues (or differences compared to 4.2-dev):
/alias of the particular tag
is missing at the end of a tag URL which is in the "Tagged Items" menu item's tag field.to 1.: As I said in chat, this is actually a bugfix from my perspective, because both with and without that tag alias at the end, you get the same page, thus having duplicate content. At least with this change we aren't creating different URLs for the same page anymore.
to 3.: I'm assuming very much that this is because of #40455.
to 2.: Are you sure that the menu items for the tag views are identical in both languages?
to 1.: As I said in chat, this is actually a bugfix from my perspective, because both with and without that tag alias at the end, you get the same page, thus having duplicate content. At least with this change we aren't creating different URLs for the same page anymore.
That makes sense of course, but I can not ready anything about this change in the description of the PR, and not all people who had the issue and want to test are in our (internal) Mattermost channel.
to 2.: Are you sure that the menu items for the tag views are identical in both languages?
@Hackwar Why should they? As said, I have created only one menu item of type "Tagged items" in language "de-DE". I have not created any in language "en-GB".
Anyway the URLs with the numeric ID of the tag at the end are weird.
to 3.: I'm assuming very much that this is because of #40455 .
Possibly, I don't know.
to 1.: As I said in chat, this is actually a bugfix from my perspective, because both with and without that tag alias at the end, you get the same page, thus having duplicate content. At least with this change we aren't creating different URLs for the same page anymore.
That makes sense of course, but I can not ready anything about this change in the description of the PR, and not all people who had the issue and want to test are in our (internal) Mattermost channel.
The question simply is, if this is a bug or not. Due to time constraints, I was not able to communicate everything extensively on every platform.
to 2.: Are you sure that the menu items for the tag views are identical in both languages?
@Hackwar Why should they? As said, I have created only one menu item of type "Tagged items" in language "de-DE". I have not created any in language "en-GB".
In that case, the URLs are supposed to be different. They are the URLs to the tags in different languages, so they are of course different. If you don't have a menu item for the tags, as in your case, you get the /component URLs.
to 2.: Are you sure that the menu items for the tag views are identical in both languages?
@Hackwar Why should they? As said, I have created only one menu item of type "Tagged items" in language "de-DE". I have not created any in language "en-GB".
In that case, the URLs are supposed to be different. They are the URLs to the tags in different languages, so they are of course different. If you don't have a menu item for the tags, as in your case, you get the /component URLs.
On 4.2 that was different, the tag URLs did depend not on the language of the current page.
And regarding my issue 3: When I am on the page of that tagged items menu item, then ALL tags have an URL WITHOUT component.
The ones in the tagged menu item have index.php/de/test-tagged-items-menu-item
, which is the URL of the current page and which would be right according to your answer to point 1.
But all other tags, i.e. those not in that menu item, they have URL's like index.php/de/test-tagged-items-menu-item/1
or index.php/de/test-tagged-items-menu-item/2
, and that seems not right to me.
P.S.: Regarding my issue 2: I mean the link to the same tag is different when I am on an English or a German page. Doesn't that mean duplicate content, too?
No, the content is different, because it is in different languages. That is not something people claim is duplicate content. (I don't really want to discuss the whole idea of duplicate content, since that is not something that actually exists anymore, etc. Lets just simply try to stick to the rule "One content item only has one URL")
In any case, I did find a bug which created the single-ID URLs you described above. I will fix that now.
As far as I can see, all issues Richard reported here today are either fixed by my above commit or are unrelated to the router.
@tramber91 Can you please explain what you expect the URLs to look like, how your setup is (which menu items do you have for tags?) and are you on Joomla 4.3.0 right now, with this file being the only additional change? I can't find a report from you elsewhere and with the given information I can't help any further.
So we still have 3 issues (or differences compared to 4.2-dev):
1. `/alias of the particular tag` is missing at the end of a tag URL which is in the "Tagged Items" menu item's tag field. 2. URLs of these tags depend on the language of the current page. 3. On the page of the "Tagged Items" menu item, the URLS for all tags in the popular tags menu are completely different to how it is on other pages.
My issue number 3 is solved with the last commit. However, the URLs of the tags in the popular tags module are still different to "normal" pages when I am on the page of the tagged items menu item.
Number 1 and 2 are desired behaviour according to @Hackwar . I'm still not sure with number 2. The URLs in the popular tags module are different for the same tag depending on the language of the current page.
I have to stop for today. Will continue with testing tomorrow or Friday, if still necessary.
@Hackwar this was an original comment about the issue #40448 (comment)
@tramber91 can you make sure that you have the current file in this PR in your site? It is very strange that you have the current behavior.
@Hackwar I check again
take this file
https://github.com/joomla/joomla-cms/blob/617d6e499c81fbc0e27b5758c90af30427fffb21/components/com_tags/src/Service/Router.php
Replace the old one by the new Router.php
But same issue
https://biomecanique.en-toutes-lettres.fr/fr/carte/cartographie-labo-formation/81-laboratoires-de-biomecanique/382-auctus-inria-ims
Click on tag France or other tags, not OK go to home page (alias /fr/component/tags/tag/france)
I miss on of your question : Can you please explain what you expect the URLs to look like !!
Just same url i had in Joomla 4.2.9
See the same page before migration
https://biomecaniquej4.en-toutes-lettres.fr/fr/carte/cartographie-labo-formation/81-laboratoires-de-biomecanique/382-auctus-inria-ims
Click on tag France or other tags, OK now, go to each menus (alias /fr/tags-pays/france)
tags-pays is the menu alias
france is the tag alias
Worked very well before.
@tramber91 would it be possible to get access to your site (or a copy) to debug this? You can reach me for example via the Joomla Mattermost or via hannes.papenberg@community.joomla.org
Thank you, I found the issue. I'm looking how we can fix this in a performant way.
The problem was, that the tags view also allows to filter by parent_id, the lookup table however didn't contain any information about this or the child tags. This change now retrieves all child tags to the parent_id tag and assigns the menu item of the parent_id to its children. This can be problemativ when a tags menu item has a child tag which is also linked via tags view with a parent_id. In that case it is a matter of which menu item is processed first and that order will in the end not be guaranteed to be stable.
This is a general issue of the tags system right now. The system is half done to support nested tags and half to be a flat list. Tags for example can't have their parents alias as part of the URL and more than one tag per URL means that we have query parameters. There are a lot of inconsistencies in the system and for a proper, stable routing, we would need something like the CategoryNode class for tags. Rewriting the whole tag system would really be awesome...
In any case, please test and then hopefully we can get this issue solved.
Thanks Hackwar
Work like a charm for my issue, each menu item have their own tags.
Same as Joomla 4.2.9
I copy your new Router.php file into the live site, and OK too, possible now to show the tags on article view, tag links use menu links.
Many thanks again
Bertrand
Thank you very much @Hackwar - can you give me instructions how to setup my test site? with my current setup i still get the same url for both tags, which is probably ok - but not the same as in 4.2.9. i would love to see how to setup the menu with the tagged items like Betrand did.
with my current setup i still get the same url for both tags, which is probably ok - but not the same as in 4.2.9.
@MacJoom As far as I understood @Hackwar that's intended for the case that you have both tags in the same tagged items menu item because when you click that link you come to that page in both cases. In 4.2.9 there was a /name-of-the-tag
part appended to the URL, which now with this PR will be removed. But as said, when clicking that link on 4.2.9 you come to the page of the tagged menu item, and when doing that on the 4.3-dev with this PR applied, it goes to the same page, they just have different URLs but show information for both tags.
That makes sense to me and is not really a b/c break since the old 4.2.9 and the new URL from this PR do the same, and the PR solves the duplicate content you have with the old 4.2.9 URL's.
So if that is the only difference between the URLs from this PR and from 4.2.9, that would be ok to me.
Any other differences should be discussed further.
Anyway, your idea with instructions on how to reproduce that special scenario is good. Let's see what comes.
@Hackwar There is one unexpected difference in the URLs in the Popular Tags module between 4.2.9 and your PR in addition to the expected one mentioned in my previous comment:
When I am at the home page or any other page except of the page which belongs to the "Tagged Items" menu item, everything is as expected.
But when I am on the page of the menu item of type "Tagged Items", I get different results:
/name-of-the-tag
appended, e.g. index.php/en/test-tagged-items-menu-item-en-gb/millions-de-de
.When I comment our or remove the following code, this difference is fixed, and the tags which are not in the tagged items menu item have the URL with component in it, like it is on all other pages:
joomla-cms/components/com_tags/src/Service/Router.php
Lines 142 to 148 in 1c29079
So either this code should be removed, or something is wrong in that if
condition which needs to be fixed.
Could you check that, and maybe you or @tramber91 could check if it still works for his scenario when that part of the code is removed?
Thanks in advance, and thanks a lot for all your efforts up to now.
Update: The more I think over about this code, the more I think it should be removed.
can you give me instructions how to setup my test site?
Create one tag and then another tag with the first tag as parent. Tag a content item with the child tag. Create a tags
menu item and set the parent tag to your parent tag. Now you have the setup from Bertrand.
Regarding the URL: Yes, it is expected, that these are the same right now. It's due to tags being simply broken.
Regarding the code mentioned by @richard67: Yes, that needs to be removed.
@tramber91 @MacJoom Could you test again with the latest changes? Thanks in advance.
I have tested this item
ok for me too, same and good result. New file seems less heavy!!
ok for me too, same and good result. New file seems less heavy!!
@tramber91 Thanks for checking and reporting back. On thing you should know: As this pull request here will very likely be too late for the upcoming 4.0.1, it will go into 4.0.2. This means that when you will update your site to 4.0.1, the fix will get lost. You can safely put again the file from this PR on your site to fix it. When you later update to 4.0.2 when that is released, the fix should be included in that version, so you won’t need to apply the fix again.
@MacJoom Could you also test again with respect to the one expected difference we explained above, and also test other scenarios like monolingual site? I have successfully tested that, too, but the more tests the better.
Thanks @richard67
i understand the manip
Suppose you speak about 4.3.1 and 4.3.2
Thanks @richard67 i understand the manip Suppose you speak about 4.3.1 and 4.3.2
@tramber91 Yes, 4.3.1 and 4.3.2.
Hi @tramber91, would you mind reporting your test results in the issue tracker (https://issues.joomla.org/tracker/joomla-cms/40474)? That way, with 2 successful tests and all the work that has been done in this PR by Hannes and all the tests you all have done, we can merge it and test it more widely until the 4.3.2 release. Thank you!
@obuisard, last file checked with Joomla 4.3.2
It is ok, same result as 4.3.1
I keep it in my live updated website.
@obuisard, last file checked with Joomla 4.3.2 It is ok, same result as 4.3.1 I keep it in my live updated website.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40474.
Does that mean it's successful for you @tramber91? Just want to make sure. And if it is successful, report it with the 'Test this' button on the issue tracker. Thank you :-)
I have tested this item
tested too with success
yes success, done concerning "test this" button
Status | Pending | ⇒ | Ready to Commit |
RTC
I have tested this item
All tag links broken, each tag has the same link as the menu item itself.
@joeforjoomla If you create a tag menu item and select all the tags in the menu item, that is expected behavior. Before the changes you had the same page, just with all the different URLs.
@joeforjoomla I can confirm what @Hackwar write in his previous comment. And just by the way: A broken link is a link which results in a 404. Do you get a 404? I am pretty sure: no. So why do you write about broken links?
@joeforjoomla Can you please answer @richard67 and me? This is a rather important issue and we are all waiting for you to either substantiate your claim or to merge this PR to be ready in time for 4.3.2. If you don't respond in 3 days, I will suggest to ignore your report.
@Hackwar @richard67 i would expect to have tag links as before:
http://joomla4/en/menualias/tag/tag1.html
http://joomla4/en/menualias/tag/tag2.html
and not for all tags:
http://joomla4/en/menualias.html
Why this? How to have a tag link then? What is the sense of this router?
I reviewed the whole code of tags again and you are right @joeforjoomla. I'm going to see what I can do here.
Status | Ready to Commit | ⇒ | Pending |
Back to pending in the issue tracker.
Labels |
Added:
?
|
@joeforjoomla Please check if this change fixes your issues.
@joeforjoomla Please check if this change fixes your issues.
@Hackwar Just perfect! :)
I have tested this item
I have tested this item
URLs now after the last change are like they were in 4.2.9, i.e. everything as expected now.
Status | Pending | ⇒ | Ready to Commit |
RTC
Labels |
Added:
?
Removed: ? |
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-05-13 14:15:00 |
Closed_By | ⇒ | obuisard |
Does this PR conflict somehow with PR #40455 ? Or would they work together?