Author Topic: Canonical issues on Product page  (Read 2683 times)

Trimud

  • Beginner
  • *
  • Posts: 18
Canonical issues on Product page
« 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:
Code: [Select]
$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

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27638
  • Always on vacation
    • Jenkin Hill Internet
Re: Canonical issues on Product page
« Reply #1 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" />
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM 3.6.11 10252 on Joomla 3.9.14 PHP 7.0.33

Trimud

  • Beginner
  • *
  • Posts: 18
Re: Canonical issues on Product page
« Reply #2 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.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3049
  • VirtueMart Version: 3.6.11
Re: Canonical issues on Product page
« Reply #3 on: October 17, 2019, 10:46:04 am »
change to another template - beez - then test

Your template is probably at fault here
regards
A

Joomla 3.9.15
php 7.2

Trimud

  • Beginner
  • *
  • Posts: 18
Re: Canonical issues on Product page
« Reply #4 on: October 17, 2019, 20:15:12 pm »
Thanks, I can confirm this is working.
Looks like the issue is with T3 blank template.

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 302
    • Audio Store
Re: Canonical issues on Product page
« Reply #5 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.
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

Trimud

  • Beginner
  • *
  • Posts: 18
Re: Canonical issues on Product page
« Reply #6 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

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 302
    • Audio Store
Re: Canonical issues on Product page
« Reply #7 on: October 21, 2019, 09:10:29 am »
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.

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).
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

Trimud

  • Beginner
  • *
  • Posts: 18
Re: Canonical issues on Product page
« Reply #8 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!

Trimud

  • Beginner
  • *
  • Posts: 18
Re: Canonical issues on Product page
« Reply #9 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