VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: Trimud on October 13, 2019, 21:27:14 PM

Title: Canonical issues on Product page
Post by: Trimud on October 13, 2019, 21:27:14 PM
Hello,

I have the following issue with Joomla 3.9.12, Virtuemart 3.6.2, PHP 7.2

I want to have canonical link in products page. Normally this should work out of the box but it's not.
I saw that this piece of code in components/com_virtuemart/views/productdetails/view.html.php doesn't work:
$canonical_link = JUri::getInstance()->toString(array('scheme', 'host', 'port')).JRoute::_($product->canonical);

If I change it to use http instead of https or add any other link the canonical link tag is loaded on the page.

The problem I'm trying to solve is the following:
- I have disabled 'Use full category tree for product links' in Virtuemart SEO config
- Now I can access the product from two URLs:
    - site/proudct-url
    - site/product-category/product-url

This will lead to duplicated content being indexed by Google so I want to handle this using rel="canonical"

Any help will be appreciated!
Thank you
Title: Re: Canonical issues on Product page
Post by: jenkinhill on October 14, 2019, 11:38:00 AM
VirtueMart already adds canonical URLs. eg this is from demo.virtuemart.net:
<link href="http://demo.virtuemart.net/zipper-pullover-detail" rel="canonical" />
Title: Re: Canonical issues on Product page
Post by: Trimud on October 16, 2019, 20:36:34 PM
Thank you Kelvyn,

I'm aware that it works on demo site but not on this site: https://growshop-bg.com/en/eazy-plug-24

As you can see there is no canonical tag found in source code for this page. It also doesn't matter if I set canonical category for this or any other product.
Title: Re: Canonical issues on Product page
Post by: AH on October 17, 2019, 10:46:04 AM
change to another template - beez - then test

Your template is probably at fault here
Title: Re: Canonical issues on Product page
Post by: Trimud on October 17, 2019, 20:15:12 PM
Thanks, I can confirm this is working.
Looks like the issue is with T3 blank template.
Title: Re: Canonical issues on Product page
Post by: Ventsi Genchev on October 18, 2019, 09:43:15 AM
Is your site multilingual?

Are there any tags:
rel="alternate"
hreflang="x-default"

Are you sure Google indexes the product in other categories?

I'm not convinced that if a site is multilingual it should have a canonical tag.
Title: Re: Canonical issues on Product page
Post by: Trimud on October 20, 2019, 22:06:10 PM
Hello,

I have disabled rel="alternate" based on request by the client and SEO company confirming this won't be an issue...

Canonical is working if I switch to beez3 template, so any help in understanding why it is not working with T3 Blank will be appreciated.

Thanks in advance
Title: Re: Canonical issues on Product page
Post by: Ventsi Genchev on October 21, 2019, 09:10:29 AM
Quote from: Trimud on October 20, 2019, 22:06:10 PM
Canonical is working if I switch to beez3 template, so any help in understanding why it is not working with T3 Blank will be appreciated.

In my opinion, the problem is not in the template, but in the language module. It is not set up correctly or changes have been made, which is why this problem occurs.
When switching to another template, the language module does not load because there is no such module position. Accordingly, the canonical tag then appears.

Quote from: Trimud on October 20, 2019, 22:06:10 PM
I have disabled rel="alternate" based on request by the client and SEO company confirming this won't be an issue...

I do not agree with this. Install the Hreflang Tag Checker add-on in Chrome.
https://growshop-bg.com/en/contacts - missing x-defaults
https://growshop-bg.com/contact-us - x-defaults and English link are missing
So are things with products.

The topic of the tags is very broad. There are many good explanations in moz.com.
https://moz.com/community/q/rel-canonical-and-rel-alternate-both-necessary
https://moz.com/blog/rel-canonical

I also do not use the full category path to the product and have no canonical tag in the product. But if it is written in the URL site/category/product, then a canonical tag also appears (site/product). But this is only if you introduce the URL manually. Google does not index such links.
For your site, too, I do not see Google indexing such links (site/category/product).
Title: Re: Canonical issues on Product page
Post by: Trimud on October 23, 2019, 19:48:29 PM
I can confirm that loading default language switcher module the canonical tag is loaded.
I am using this module as it helps with proper redirect to correct product in the other language: https://shop.st42.fr/en/products/multi-language-for-virtuemart.htm
I'll check the code and see if I can find something related to canonical.

I have the same opinion about href tags, but most users in Bulgaria have their browsers installed with English language. This means that they were seeing search results for the site in english and rival websites are showing results in Bulgarian...

Thanks for your input Ventsi, much appreciated!
Title: Re: Canonical issues on Product page
Post by: Trimud on October 23, 2019, 19:56:52 PM
I can also confirm that if I disable hreflang config in this module the canonical is working properly: https://prnt.sc/pn6yv5