? Success

User tests: Successful: Unsuccessful:

avatar shur
shur
27 Sep 2014

I found out that com_content still generates double URLs to articles in some cases. It's an old issue, and it's mostly removed in Joomla 3.x, but in some places we still can find that. It happens because when creating article links catslug is used instead of catid.

How to test

  • SEF must be disabled;
  • Open category blog page and we see how the links look like. Practically all article links in com_content have this view: http://test.com/index.php?option=com_content&view=article&id=49:article-alias&catid=12&Itemid=101
  • But the same articles have different URLs in other places: http://test.com/index.php?option=com_content&view=article&id=49:article-alias&catid=12:category-alias&Itemid=101

Where you can find "incorrect" links:

  • Featured articles page, when featured links are used (menu item settings - layout - features links);
  • Archived articles page;
  • Next and Prev button links on any article page;
  • Title links on search results page;
  • Title links on smart search results page;

Expected results:

http://test.com/index.php?option=com_content&view=article&id=49:article-alias&catid=12&Itemid=101
All the links to the same article must be identical in everywhere in Joomla. Otherwise, it's a serious SEO mistake.

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

Related PR for modules:
Remove catslug in content modules #4363

avatar zero-24 zero-24 - change - 27 Sep 2014
Category Components Front End Layout Templates (site)
avatar shur
shur - comment - 27 Sep 2014

Third party extensions can still use catslug. To resolve double URL problem in this case I suggest to add one line in function getArticleRoute (/components/com_content/helpers/route.php)

$catid = (int) $catid;

This line eliminates catslug usage in all places where this function is use and article URLs will always be of the same view as in com_content.

avatar brianteeman brianteeman - change - 1 Oct 2014
Category Components Front End Layout Templates (site) SEF
avatar shur
shur - comment - 1 Oct 2014

By some unknown reason the full description with instruction how to test that disappeared...

I'm just posted that again.

avatar shur
shur - comment - 7 Oct 2014

This PR has full description and how to test it, but on issues.joomla.org it is absent:
http://issues.joomla.org/tracker/joomla-cms/4371
Why does it happen?

avatar zero-24
zero-24 - comment - 7 Oct 2014

This PR has full description and how to test it, but on issues.joomla.org it is absent:

@shur see here: joomla/jissues#515

I will add it manually now

avatar zero-24 zero-24 - change - 7 Oct 2014
The description was changed
avatar zero-24
zero-24 - comment - 7 Oct 2014

@shur should ok now. If not you can edit it also here until the bug is fixed. Thanks

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

avatar shur
shur - comment - 7 Oct 2014

@zero-24 Thanks!
Now I am aware of sync problem.

avatar suredweb
suredweb - comment - 17 Oct 2014

@test It's good!

avatar suredweb suredweb - test_item - 17 Oct 2014 - Tested successfully
avatar Bakual
Bakual - comment - 17 Oct 2014

Actually I think this is the wrong approach. Using catslug would be the good way and only using the catid the wrong way. Imho the whole idea behind the catslug is to have an URL where the category alias is present. With your change, this will be removed, thus making the whole catslug useless.

On the other hand, for the article we still use the slug, which makes the URL inconsistent between article id and category id.
.
Please also test with SEF enabled if this has any impact, I guess it will remove the alias there as well which would be very bad.

On a sidenote: Duplicate URLs for the same content aren't really that big a SEO problem as long as they are on the same domain. That "problem" is solved by adding canonical URLs to the page.

avatar shur
shur - comment - 17 Oct 2014

The purpose of this PR is to make article URL creation consistent and use only one approach everywhere in Joomla.

Major pages of com_content (blog page, article page, titles, etc) don't use catslug. Catslug is used only for accessory elements (next/prev button, search results.) So it's reasonable to assume that is the main approach for article URLs is to use only catid.

Moreover, catslug has lots of cons:
1. Core content component practically doesn't use catslug.
2. Catslug is not used in SEF URL creation. Then what is the purpose to have catslug in non-SEF URLs?
3. To organize support for catslug in Joomla extensions you have to retrieve additional field from database which makes the request more complicated and slower.

Please also test with SEF enabled if this has any impact, I guess it will remove the alias there as well which would be very bad.

No, that's wrong thinking. Despite the fact that com_content doesn't use catslug, SEF urls look correctly (with category alias). Catslug doesn't impact SEF any way.

On a sidenote: Duplicate URLs for the same content aren't really that big a SEO problem as long as they are on the same domain. That "problem" is solved by adding canonical URLs to the page.

Well, it sounds like "First let's create a problem, and then find ways how to solve it."
A more rational approach is not to create double urls.

You underestimate the double URL issue. In fact, it's one of serious Joomla problems and many people know about it and give up using Joomla for this reason.

Summary:
Hope you agree that Joomla should use one approach for catslug usage.
Logically there two ways - remove catslug or add catslug, but do that everywhere in Joomla.

My PR removes catslug from places where it is still preserved since Joomla 1.5 times. The reasons I described above.

The second way - to add catslug would require much more efforts and lots of changes in com_content component. It's just unreasonable.

avatar Bakual
Bakual - comment - 17 Oct 2014

category slug is used in SEF links like this for example: index.php/article-category-list/82-testcategory/73-testarticle

Imho, using the catslug is the correct way and it should be changed in the instances where it isn't used.

avatar hanshenrikchr hanshenrikchr - test_item - 17 Oct 2014 - Tested successfully
avatar shur
shur - comment - 17 Oct 2014

@Bakual
I see you don't get the point.
Of course category ID + category alias are used in SEF urls, but they are retrieved separately from database, and they are not from catslug in non-SEF URLs.

For example: we have two non-SEF urls (without and with catslug):

index.php?option=com_content&view=article&id=31:christmas&catid=10&Itemid=101
index.php?option=com_content&view=article&id=31:christmas&catid=10:recipes&Itemid=103

When I enable SEF both URLs get the same SEF link:
index.php/10-recipes/31-christmas
index.php/10-recipes/31-christmas

It means that cagtslug from non-SEF URLs ARE NOT USED when creating SEF urls.
So you don't need catslug in non-SEF URLs.

If you don't trust me - just test.

avatar Bakual
Bakual - comment - 17 Oct 2014

Of course category ID + category alias are used in SEF urls, but they are retrieved separately from database, and they are not from catslug in non-SEF URLs.

Ah true. You're right.

However I still think they make sense in non-SEF URLs and should be fixed where they are missing. But that's maybe just me.

avatar shur
shur - comment - 17 Oct 2014

However I still think they make sense in non-SEF URLs and should be fixed where they are missing. But that's maybe just me.

I see that I haven't convinced you yet but at least managed to explain.

Consider another argument:
there is no need to use catslug in Joomla 3.x because 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)

avatar roland-d
roland-d - comment - 27 Nov 2014

@Hackwar can we have your input here please?

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

avatar shur shur - reference | b4b94cb - 14 Dec 14
avatar shur shur - reference | d457bb5 - 14 Dec 14
avatar shur shur - close - 14 Dec 2014
avatar shur
shur - comment - 14 Dec 2014

Finally, I close this PR because its almost fixed by @Hackwar here: #5276

avatar shur shur - close - 14 Dec 2014
avatar shur shur - change - 14 Dec 2014
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-12-14 12:04:14
avatar shur shur - head_ref_deleted - 14 Dec 2014

Add a Comment

Login with GitHub to post a comment