User tests: Successful: Unsuccessful:
The request is to use the same principle for creating link to articles in content modules.
Since catslug is used in some modules and is not used in other module, this potentially leads to double article URLs (when SEF is disabled).
E.g. mod_news uses only catid instead of catslug when creating links to articles.
Steps to reproduce the issue
The results I got:
Articles Category Module and Latest News Modulehttp://test.com/index.php?option=com_content&view=article&id=49:article-alias&catid=12:category-alias&Itemid=101
Articles Newsflash Modulehttp://test.com/index.php?option=com_content&view=article&id=49:article-alias&catid=12&Itemid=101
Expected result
All the links to the same article must be identical in all modules. Otherwise, it's a serious SEO mistake.
Labels |
Added:
?
|
@betweenbrain
I added a description to the PR. And now I'll add some URL examples.
@betweenbrain Done. See the updated description.
Thanks @shur!
Tested following the above instructions, and compared the link generated by the Featured Articles and Category Blog menu item type.
Featured Articles:
http://localhost/dev/joomla/testing/index.php?option=com_content&view=article&id=1:test-001&catid=2&Itemid=101
Category Blog:
http://localhost/dev/joomla/testing/index.php?option=com_content&view=article&id=1:test-001&catid=2&Itemid=101
Articles Category:
http://localhost/dev/joomla/testing/index.php?option=com_content&view=article&id=1:test-001&catid=2:uncategorised&Itemid=101
Latest News:
http://localhost/dev/joomla/testing/index.php?option=com_content&view=article&id=1:test-001&catid=2:uncategorised&Itemid=101
Articles - Newsflash:
http://localhost/dev/joomla/testing/index.php?option=com_content&view=article&id=1:test-001&catid=2&Itemid=101
Featured Articles:
http://localhost/dev/joomla/testing/index.php?option=com_content&view=article&id=1:test-001&catid=2&Itemid=101
Category Blog:
http://localhost/dev/joomla/testing/index.php?option=com_content&view=article&id=1:test-001&catid=2&Itemid=101
Articles Category:
http://localhost/dev/joomla/testing/index.php?option=com_content&view=article&id=1:test-001&catid=2:uncategorised&Itemid=101
Latest News:
http://localhost/dev/joomla/testing/index.php?option=com_content&view=article&id=1:test-001&catid=2:uncategorised&Itemid=101
Articles - Newsflash:
http://localhost/dev/joomla/testing/index.php?option=com_content&view=article&id=1:test-001&catid=2:uncategorised&Itemid=101
This PR does successfully unify the system URLs generated by the three modules, which I am in favor of doing. But, there they are different than those generated by the com_content component. I'd think that they should be the same.
Regarding backwards compatibility, while the URLs are changed, they do seem to be routed to the same article. While I do not like to see URLs change in a non major release, I think this change may be a safe. This probably needs more thorough testing to be sure.
Please note that the SEF URLs generated before and after applying this patch are the same as one another and remain unchanged.
@betweenbrain
Thanks for the detailed test. That's exactly what I wanted to pull the attention to.
I also think that the link creation and link view must be the same in all extensions within Joomla.
I've made some tests and was shocked by the results.
@test
Menu Item: Category Blog can contain such article layouts:
Leading Articles
Intro Articles
Links
Let's display all of them and see what links they generate.
Leading Article Title URL:
/index.php?option=com_content&view=article&id=30:article-alias&catid=10:category-alias&Itemid=102
Leading Article Readmore URL:
/index.php?option=com_content&view=article&id=30:article-alias&catid=10&Itemid=102
Intro Article Title URL:
/index.php?option=com_content&view=article&id=31:article-alias&catid=10:category-alias&Itemid=102
Intro Article Readmore URL:
/index.php?option=com_content&view=article&id=31:article-alias&catid=10&Itemid=102
Link Article Title URL:
/index.php?option=com_content&view=article&id=32:article-alias&catid=10&Itemid=102
As you can see the same article has different URLs (the title and readmore have different URLs!)
And here I don't mean two different extensions - it happens within one extension - com_content.
Is there a special purpose for using catslug?
Probably it would be enough to use only catid in all extensions that create article links? In this case, there won't be need for every module working with com_content to retrieve category alias from database, thus making the query lighter.
Without researching it, I can't answer why catslug is used in some the URLs. But, I can tell you that we can't safely remove it as some third-party extensions may rely on that part of that URL parameter for certain functionality.
I don't think adding catslug would break anything, as it is used in some places, but tests will need to support that assumption.
Thanks for looking at this!
After going deeper into the issue I came to conclusion that only catid must be used, and catslug must be removed.
The major point is that process link function: ContentHelperRoute::getArticleRoute
requires only catid - integer value.
/components/com_content/helpers/route.php
public static function getArticleRoute($id, $catid = 0, $language = 0)
There is an easy solution how to organize compatibility with third-party extensions that use this function - just to edit one line in this function.
I decided to close this pull request and start working on another one where I replace catslug with catid.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-09-27 09:25:43 |
Can you explain the reason for this change? What problem does it solve or improvements made?