System - SEF
Site Domain
fieldrel="canonical"
tag identifies SEF and non-SEF linksonly SEF links will be defined as rel="canonical"
example:
https://site.com/my-article
any links (SEF and non-SEF) are defined as rel="canonical"
example:
https://site.com/my-article
https://site.com/index.php?option=com_content&view=article&id=1
^ both of these links and any other links are defined as canonical
Joomla 5.0.2
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
Information Required
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-02-06 15:20:21 |
Closed_By | ⇒ | Quy |
Closing as duplicate.
Joomla has no real way of knowing what the canonical page is
@weeblr I will respond to your comment here, in a relevant topic #45428 (comment)
As far as I know, @joomla generates a canonical link (for articles
and categories
) based on two data:
menu item
category
(if there is no menu item for the link)Is it possible for the rel="canonical"
tag to be added to the link that is tied to the menu item, and if the link is not tied to the menu item, then the rel="canonical"
tag will be generated in relation to the category to which this link belongs.
I think that the problem with the formation of an incorrect canonical link would then be solved.
As far as I know, https://github.com/joomla generates a canonical link (for articles and categories) based on two data:
Not at all. Joomla has no knowledge of any canonical URL and does not try to compute a canonical tag.
The only thing it does (it's done by the SEF system plugin), is change the domain.
If you configured Site domain" to be https://example.com
, the SEF plugin will issue a canonical tag on all pages of the site with that domain.
So if current URL is https://example.com/some-url?fcblid=12356
, the canonical tag will also be: https://example.com/some-url?fcblid=12356
And if the site can be accessed through another domain, for instance https://example.net/some-url?fcblid=12356
, then the canonical becomes simply also: https://example.com/some-url?fcblid=12356
Not at all. Joomla has no knowledge of any canonical URL and does not try to compute a canonical tag. The only thing it does (it's done by the SEF system plugin), is change the domain.
I didn't mean the Site Domain
setting, I mean that the canonical link (not rel="canonical"
tag) in Joomla is created based on a menu item, or based on a specific category link.
I'm talking about the link you can click when viewing the main page of a website (I don't mean the rel="canonical"
tag).
Why doesn't Joomla add a rel="canonical"
tag to this canonical link, instead of adding a canonical tag to every (including non-canonical) link in the current setup.
I just want to say that this could be a new feature of the System - SEF
plugin.
I mean that the canonical link (not rel="canonical" tag) in Joomla is created based on a menu item, or based on a specific category link.
Best to use canonical URL then, instead of canonical link.
Why doesn't Joomla add a rel="canonical" tag to this canonical link, instead of adding a canonical tag to every (including non-canonical) link in the current setup.
Because that's not the role of a rel=canonical tag. The rel=canonical tag is only useful on duplicates.
If the canonical URL for a given page is https://example.com/some-article
, then you do not need a rel=canonical link inside that page.
You need a rel=canonical pointing at https://example.com/some-article
on all other pages are that have different URLs but are in fact the same page.
For instance on:
https://example.com/some-article?fbclid=12346
(URL shared on Facebook)https://example.com/some-article?utm_campaign=may-2025
(ad tracking)https://example.com/some-category/some-article
https://example.com/index.php?option=com_content&view=article&id=12
And Joomla has no mechanism to identify which is a duplicate and which is a totally different piece.
Which is why Joomla only adds a canonical to a page when the Domain site is in use - and still does a bad job at it in most cases, because the domain is only a small part of the problem.
And Joomla has no mechanism to identify which is a duplicate and which is a totally different piece.
I think this is exactly the problem that Joomla needs to solve.
It would be great if Joomla could detect the correct canonical link and add the rel="canonical"
tag to all non-canonical pages.
I don't see how that's possible generally speaking. Maybe just for Joomla content, but certainly not for extensions. And even just for regular content, there are many edge cases: what if a user creates 2 menu items to the same category or the same article? Or if there are 2 menu items to the same category, one list and one blog, and articles in these categories can be reached by 2 URLs. Which one is the canonical one? will the user be allowed to change the canonical if they prefer to have another one? how?
In the case of canonicals, it much, much better to do nothing than do wrong.
The only improvement I can think of would be to prevent the SEF plugin to add a canonical tag on pages from the main domain. That is: add only canonicals on pages of the duplicate domains.
I don't see how that's possible generally speaking. Maybe just for Joomla content, but certainly not for extensions.
At least this should be the case for Joomla content, third party developers can implement canonical links in their components themselves, or they could also use the Joomla router to do this.
And even just for regular content, there are many edge cases: what if a user creates 2 menu items to the same category or the same article? Or if there are 2 menu items to the same category, one list and one blog, and articles in these categories can be reached by 2 URLs. Which one is the canonical one? will the user be allowed to change the canonical if they prefer to have another one? how?
There is a solution for this option as well. If the user creates a menu item, then the menu item settings can have a "canonical/non-canonical" link option, and if the user selects the "non-canonical" link option, then he will be able to specify another menu item in the menu item settings that is canonical.
As for articles and other content that is not a separate menu item, then for articles, a "canonical" link will be automatically generated from the menu item that is specified as "canonical" in the menu item settings.
Every problem has a reasonable solution.
The only improvement I can think of would be to prevent the SEF plugin to add a canonical tag on pages from the main domain. That is: add only canonicals on pages of the duplicate domains.
This should have been the default relative to the setting in the Site Domain
that already exists.
There is a solution for this option as well. If the user creates a menu item, then the menu item settings can have a "canonical/non-canonical" link option, and if the user selects the "non-canonical" link option, then he will be able to specify another menu item in the menu item settings that is canonical.
Canonical links are too complex a notion. It has to be automated.
As for articles and other content that is not a separate menu item, then for articles, a "canonical" link will be automatically generated from the menu item that is specified as "canonical" in the menu item settings.
And how do you decide to which "canonical" menu a piece of content "belongs" to if there are several possible options as in the examples I gave above. You certainly cannot count on users. If you could, they would already use the current solution which is to use a menu item of type alias. Which they don't. Because it's already too complicated.
Anyway, good luck with making Joomla generate canonical tags ;)
@weeblr in fact, you are mistaken when you say that Joomla does not know which link for an article is canonical.
if we use only one domain (the site is not available on different domains), then when you go to an article, Joomla always generates one canonical link for the article.
You can check this yourself right now:
article title
clickablesite.com/category-news/11-article
, then go to the duplicate/non-canonical URL like site.com/category-video/11-article
and you will see that despite the fact that you followed the non-canonical link, the article title
is clickable and the article title
, when clicked, will redirect you to the only correct canonical link.The only problem is that Joomla still does not add a rel="canonical"
tag for non-canonical article pages.
Joomla knows which page of the article is canonical, this is a fact and anyone can check it manually.
in fact, you are mistaken when you say that Joomla does not know which link for an article is canonical.
Considering my experience with Joomla, that is extremely unlikely. The router certainly has made many progress over the years though, so for many sites, there will never be any issue (and therefore canonical tags are not needed at all).
if we use only one domain (the site is not available on different domains), then when you go to an article, Joomla always generates one canonical link for the article.
It creates as many links as there are menu items path to it. It may pick one, normally the first one it finds in the menu structure that matches best the non-sef request, but that does not mean multiple URLs are not generated.
Let's say if the canonical link of your article is site.com/category-news/11-article, then go to the duplicate/non-canonical URL like site.com/category-video/11-article and you will see that despite the fact that you followed the non-canonical link, the article title is clickable and the article title, when clicked, will redirect you to the only correct canonical link.
Then why doen't it use always the same link in the first place?
The router certainly has made many progress over the years though, so for many sites, there will never be any issue (and therefore canonical tags are not needed at all).
if the router for Joomla has become better from a technical point of view over the years, it does not mean that articles do not need a rel="canonical"
tag for those incorrect URLs at which the article is available.
Then why doen't it use always the same link in the first place?
The Joomla router is designed in such a way that the number of duplicate/non-canonical links for each article grows exponentially.
The Joomla router cannot redirect non-canonical URLs to a canonical URL, I'm not even talking about pages like print output
, I'm talking exclusively about cases when one article mistakenly begins to be accessible via links leading to other categories, via links leading to other directories.
Duplicate #26416?