VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Rune Rasmussen on August 17, 2022, 10:15:48 AM

Title: [SOLVED] Force Canonical Category doesn't work? [VM 4.0.2]
Post by: Rune Rasmussen on August 17, 2022, 10:15:48 AM
QuoteEDIT: Note that it was caused by PWT SEO, disabling it makes the Canonical URLs correct.
EDIT2: Changing the default setting for 'Self referencing canonical' to 'No', in the configuration for the PWT SEO System plugin, also helps if you like to continue using PWT SEO.

Isn't there anyone else noticing that the 'Force Canonical Category' doesn't work for Canonical URLs. Does it work for you, have it ever worked?


As you might be aware of, there is a field for 'Force Canonical Category' on the product edit screen, right bellow the 'Categories' selection field.


I do expect this to be working for setting a Canonical URL in the source code of the site (since it's named Canonical), to tell Google etc. that it's the same product listed in multiple categories (having the same Canonical URL for all listings), to avoid it being read as a duplicate. But that doesn't seem to be the case now ...?


Let's say I add a product to both 'Sales' and 'Phones' categories, and select 'Phones' also on 'Force Canonical Category'. Then I visit FE and browses into the 'Sales' category, select to view the product details, and looks at the source code - the Canonical URL is set to the 'Sales' category. Then I browse into the 'Phones' category, select the same product etc., and now the Canonical URL is set to 'Phones' category - so it's changing and not using the selected 'Force Canonical Category', affecting your SEO ratings ...

VM 4.0.2 10661, Joomla! 3.10.10 using vmbeez3


VM Configuration -> SEO Settings

SEO Disabled: Not selected   
Use product link suffix: Selected
Seo Suffix: -details
Translate Strings: Selected
Transliterate slugs: Selected
Use Product and Category IDs: Selected
Use full category tree for product links: Selected
Strict mode: Not selected
SEF for cart links: Selected

J! Global Configuration -> SEO Settings
Search Engine Friendly URLs: Yes
Use URL Rewriting: Yes
Add Suffix to URL: Yes
Unicode Aliases: No
Site Name in Page Titles: After
Title: Re: Force Canonical Category doesn't work? [VM 4.0.2]
Post by: GJC Web Design on August 17, 2022, 12:00:40 PM
Just tested on VM3.8.8 and there it is working correctly ...  canonical remains the same no matter what category you accessed a product from

and on VirtueMart 4.0.7 10693

https://virtuemartshop.eu/j4/shop/wear/mister/zipper-pullover-detail
https://virtuemartshop.eu/j4/shop/wear/lady/zipper-pullover-detail

canonical remains   <link href="https://virtuemartshop.eu/j4/shop/wear/lady/zipper-pullover-detail" rel="canonical">
Title: Re: Force Canonical Category doesn't work? [VM 4.0.2]
Post by: Rune Rasmussen on August 17, 2022, 12:02:46 PM
Using the same configuration as I mentioned above, or something different?
And also tested the same on vmbeez3?
Title: Re: Force Canonical Category doesn't work? [VM 4.0.2]
Post by: GJC Web Design on August 17, 2022, 12:06:47 PM
same config... but tested on J4.1.5

I can attach VirtueMart 4.0.7 10693 if u want to try it....
Title: Re: Force Canonical Category doesn't work? [VM 4.0.2]
Post by: Rune Rasmussen on August 17, 2022, 12:11:37 PM
OK, sorry, forgot to mention it's on Joomla 3.10.10


I guess Joomla! 4 is different, and it's long till everyone can make that move ...
Title: Re: Force Canonical Category doesn't work? [VM 4.0.2]
Post by: GJC Web Design on August 17, 2022, 12:13:07 PM
I think if it works now on J4 it will work on J3  - your welcome to try but I don't have the time at the moment
Title: Re: Force Canonical Category doesn't work? [VM 4.0.2]
Post by: Rune Rasmussen on August 17, 2022, 12:15:01 PM
Yep, the problem is it doesn't work at the moment for us, in any template - and as fare as I know it never did.

Anyhow no 4.0.7 available, nor any changes to SVN for some time. Have VM gotten into stealth development?
Title: Re: Force Canonical Category doesn't work? [VM 4.0.2]
Post by: GJC Web Design on August 17, 2022, 12:33:56 PM
working here J3 VM3.8.8

https://www.stonemania.co.uk/categories/crystals-rocks-minerals/amethyst-crystals-1-detail

you can access it from

https://www.stonemania.co.uk/categories/for-younger-collectors
and
https://www.stonemania.co.uk/categories/crystals-rocks-minerals/rough

<link href="https://www.stonemania.co.uk/categories/crystals-rocks-minerals/amethyst-crystals-1-detail" rel="canonical" />
Title: Re: Force Canonical Category doesn't work? [VM 4.0.2]
Post by: Rune Rasmussen on August 17, 2022, 12:37:17 PM
Noticed they all are products having variants to select, so wonder if that has anything to say also.


Anyhow, something must be different somewhere, in settings or anything else if it works for some, but not others.
Title: Re: Force Canonical Category doesn't work? [VM 4.0.2]
Post by: Rune Rasmussen on August 17, 2022, 12:55:28 PM
You're right, it works - if we disable PWT SEO.


So it seems like it's PWT SEO causing our issues ...  ::)

Thanks for pushing me in the right direction!