Author Topic: Adding canonical tags for products in multiple categories?  (Read 3109 times)

kevinwood

  • Jr. Member
  • **
  • Posts: 151
Adding canonical tags for products in multiple categories?
« on: March 03, 2011, 20:00:08 pm »
I've searched and searched and haven't found an answer to this.  Are there any freely available extensions that will determine on the fly whether a product is in multiple categories and add canonical reference tags to the product pages in all categories but one?

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10352
  • VirtueMart Version: 3+
Re: Adding canonical tags for products in multiple categories?
« Reply #1 on: March 04, 2011, 01:13:20 am »
1st, you want the tag to be in on the product for every category. Not just the wrong category.

I use forrest meta hack

https://forum.virtuemart.net/index.php?topic=65697.315

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

kevinwood

  • Jr. Member
  • **
  • Posts: 151
Re: Adding canonical tags for products in multiple categories?
« Reply #2 on: March 04, 2011, 03:09:39 am »
Why in the world would you want the canonical tag to be on the product page for every category?  One of them has to be the canonical url.

Also, thanks but I'm not interested in core hacks.  I'd rather make my own extension.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10352
  • VirtueMart Version: 3+
Re: Adding canonical tags for products in multiple categories?
« Reply #3 on: March 04, 2011, 12:37:24 pm »
because thats the way canonical works

You want to assign a canonical url to a product
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

kevinwood

  • Jr. Member
  • **
  • Posts: 151
Re: Adding canonical tags for products in multiple categories?
« Reply #4 on: March 04, 2011, 14:04:54 pm »
It is not necessary to have the canonical tag in the header for the canonical url.  I went to confirm this and found this note from Matt Cutter:

1. On the true canonical page, you can just leave out the canonical tag
2. On the true canonical page, you can keep the canonical tag, but make the tag point back to the same url.
You’re welcome to do whatever is easiest for your particular programming environment.

kevinwood

  • Jr. Member
  • **
  • Posts: 151
Re: Adding canonical tags for products in multiple categories?
« Reply #5 on: March 04, 2011, 16:02:22 pm »

I use forrest meta hack

https://forum.virtuemart.net/index.php?topic=65697.315


Correct me if I am wrong, but ot looks like you have to manually specify which product/category page is canonical with this.  I'm looking for something that can do it on the fly.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10352
  • VirtueMart Version: 3+
Re: Adding canonical tags for products in multiple categories?
« Reply #6 on: March 04, 2011, 17:29:19 pm »

Correct me if I am wrong, but ot looks like you have to manually specify which product/category page is canonical with this.  I'm looking for something that can do it on the fly.

yes, you do have to do it manually.

You should pick the best category url for the product, and not let some script do it.

And as far as dynamically generating the tag, I would NOT trust any script to do this. There is a change it would change depending on other factors.


J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

kevinwood

  • Jr. Member
  • **
  • Posts: 151
Re: Adding canonical tags for products in multiple categories?
« Reply #7 on: March 04, 2011, 17:51:28 pm »
I don't know what you mean by "best".  My wife has a jewelry store and, for instance, she might have a product in both "beaded necklaces" and "necklaces for men".  Why do I care which one is the canonical one?  I'd much rather have a plugin just pick one rather than spending hours doing it manually.

I don't think it matters in this case if something causes the canonical url to change.  Search engines keep track of which urls are duplicates and which one is canonical.  If something causes the canonical url to change from the "beaded necklaces" category to the "necklaces for men" category, Google will just move the pagerank from the one to the other.


kevinwood

  • Jr. Member
  • **
  • Posts: 151
Re: Adding canonical tags for products in multiple categories?
« Reply #8 on: March 07, 2011, 03:18:43 am »
Well, I did it.  As it turns out, you don't need to specify a category ID in the URL as long as you specify the flypage.  This seems like the perfect answer for the canonical link, so I wrote a plugin that sets the canonical tag to just the product id and flypage. 

I think this will be perfect to set the og:url to for Open Graph tags as well, so I will probably roll it into the vmopengraph plugin.