User tests: Successful: Unsuccessful:
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.
http://test.com/index.php?option=com_content&view=article&id=49:article-alias&catid=12&Itemid=101
http://test.com/index.php?option=com_content&view=article&id=49:article-alias&catid=12:category-alias&Itemid=101
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.
Labels |
Added:
?
|
Category | ⇒ | Components Front End Layout Templates (site) |
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.
Category | Components Front End Layout Templates (site) | ⇒ | SEF |
By some unknown reason the full description with instruction how to test that disappeared...
I'm just posted that again.
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?
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
@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.
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.
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.
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.
@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.
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.
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)
@Hackwar can we have your input here please?
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4371.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-12-14 12:04:14 |
Related PR for modules:
Remove catslug in content modules #4363