? Success

User tests: Successful: Unsuccessful:

avatar shur
shur
26 Sep 2014

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

  • disable SEF (SEO Settings - set all fields: No)
  • publish thee content modules Articles Category Module, Latest News Module, Articles Newsflash Module in the same page for comparison.
  • In the module settings select the same one category as source (the same for three modules).
  • Compare URLs to the same article in different modules.

The results I got:
Articles Category Module and Latest News Module
http://test.com/index.php?option=com_content&view=article&id=49:article-alias&catid=12:category-alias&Itemid=101

Articles Newsflash Module
http://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.

avatar shur shur - open - 26 Sep 2014
avatar jissues-bot jissues-bot - change - 26 Sep 2014
Labels Added: ?
avatar betweenbrain
betweenbrain - comment - 26 Sep 2014

Can you explain the reason for this change? What problem does it solve or improvements made?

avatar shur
shur - comment - 26 Sep 2014

@betweenbrain
I added a description to the PR. And now I'll add some URL examples.

avatar betweenbrain
betweenbrain - comment - 26 Sep 2014

Thanks @shur, that is very helpful. Can you provide test instructions as well?

avatar shur
shur - comment - 26 Sep 2014

@betweenbrain Done. See the updated description.

avatar betweenbrain
betweenbrain - comment - 26 Sep 2014

Thanks @shur!

@test

Before applying the patch

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

After applying this PR

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

Conclusion

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.

avatar shur
shur - comment - 26 Sep 2014

@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.

avatar shur
shur - comment - 26 Sep 2014

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.

avatar shur
shur - comment - 26 Sep 2014

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.

avatar betweenbrain
betweenbrain - comment - 26 Sep 2014

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!

avatar shur
shur - comment - 26 Sep 2014

found little discussion about why catslug is using:
[#32768] Fix wrong param to helper route #2566

@Hackwar

FYI: The Joomla core routers don't require the catslug. Its a leftover from Joomla 1.5 and hasn't been necessary since Joomla 1.6

avatar shur shur - close - 27 Sep 2014
avatar shur
shur - comment - 27 Sep 2014

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.

avatar shur shur - close - 27 Sep 2014
avatar shur shur - change - 27 Sep 2014
The description was changed
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-09-27 09:25:43
avatar shur shur - head_ref_deleted - 3 Jul 2015

Add a Comment

Login with GitHub to post a comment