- Posts: 26
COMMUNITY FORUM
Disabling canonical plugin in k2 2.10.2 not working.
- zamarza1
- Topic Author
- Offline
- Junior Member
Less
More
4 years 10 months ago #174419
by zamarza1
Disabling canonical plugin in k2 2.10.2 not working. was created by zamarza1
Hi,
I was facing a problem with my multilangual website (English and French) for several days.
The two home menus had canonical urls which is not allowed for SEO. I read that it can be very bad for my SEO. So I tried to figured out the problem.
First, I thought the problem was in SH404SEF. They found it was not the case.
Then, I thought it was in JSiteMap Pro. John Daglemore found it was not the case.
But he found that disabling canonical URL in K2 settings was not working.
He proposed me a hack.
In the file root/components/com_k2/views/item/view.html.php at line 757 I added 'return;' to solve my problem.
private function setCanonicalUrl($url)
{
return;
$document = JFactory::getDocument();
$params = K2HelperUtilities::getParams('com_k2');
$canonicalURL = $params->get('canonicalURL', 'relative');
if ($canonicalURL == 'absolute') {
$url = substr(str_replace(JUri::root(true), '', JUri::root(false)), 0, -1).$url;
}
$document->addHeadLink($url, 'canonical', 'rel');
}
Now it works. The SEO error has disappeared.
I know that it is not the right solution. Maybe there is a bug.
Please would you investigate the problem?
Thanks for your help
Amar Guillen
I was facing a problem with my multilangual website (English and French) for several days.
The two home menus had canonical urls which is not allowed for SEO. I read that it can be very bad for my SEO. So I tried to figured out the problem.
First, I thought the problem was in SH404SEF. They found it was not the case.
Then, I thought it was in JSiteMap Pro. John Daglemore found it was not the case.
But he found that disabling canonical URL in K2 settings was not working.
He proposed me a hack.
In the file root/components/com_k2/views/item/view.html.php at line 757 I added 'return;' to solve my problem.
private function setCanonicalUrl($url)
{
return;
$document = JFactory::getDocument();
$params = K2HelperUtilities::getParams('com_k2');
$canonicalURL = $params->get('canonicalURL', 'relative');
if ($canonicalURL == 'absolute') {
$url = substr(str_replace(JUri::root(true), '', JUri::root(false)), 0, -1).$url;
}
$document->addHeadLink($url, 'canonical', 'rel');
}
Now it works. The SEO error has disappeared.
I know that it is not the right solution. Maybe there is a bug.
Please would you investigate the problem?
Thanks for your help
Amar Guillen
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 10 months ago #174424
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Disabling canonical plugin in k2 2.10.2 not working.
Good catch. This was obviously a bug and it's been fixed in K2 v2.10.3 (dev) which you can safely upgrade to from: getk2.org/downloads/?f=K2_Development_Release.zip
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- zamarza1
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 26
4 years 10 months ago #174430
by zamarza1
Replied by zamarza1 on topic Disabling canonical plugin in k2 2.10.2 not working.
Hi Fotis,
thank you very much for the update. It works perfectly. It is a great news.
I got a lot pages disappeared because the SEO problem generated by the bug.
Thanks for all
And because it is never too late, I wish you a happy new year.
Amar Guillen
thank you very much for the update. It works perfectly. It is a great news.
I got a lot pages disappeared because the SEO problem generated by the bug.
Thanks for all
And because it is never too late, I wish you a happy new year.
Amar Guillen
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 10 months ago #174445
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Disabling canonical plugin in k2 2.10.2 not working.
Happy new year to you too Amar :)
Keep in mind that you can still use canonical URLs even for multilingual sites. According to Google webmasters.googleblog.com/2011/12/new-markup-for-multilingual-content.html it just requires some additional meta tags.
Since I have a new plugin in the works for multilingual associations in K2, I will make sure to add these as well.
Keep in mind that you can still use canonical URLs even for multilingual sites. According to Google webmasters.googleblog.com/2011/12/new-markup-for-multilingual-content.html it just requires some additional meta tags.
Since I have a new plugin in the works for multilingual associations in K2, I will make sure to add these as well.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.