Search code examples
javascriptdomseosearch-enginecanonical-link

Canonical updated with JS - is this used by SEO?


Due to some hindrance by BigCommerce, I have to update my products' canonical links using Javascript. This is because BigCommerce auto-generates canonical URLs and I had to modify a template file that affects each product.

I was able to replace the URL by using Javascript to find the canonical in the DOM and replacing the href appropriately. My code works however, I only notice these changes in the DOM when inspecting the head of the page. Viewing the source shows the original canonical still there.

After running my page through a Canonical URL Checker (http://www.seoreviewtools.com/canonical-url-location-checker/), it displays the original source link instead of my modified one. Will search engines process my new canonicals? Is there another way around this?


Solution

  • So first I must say, this seems to be a bad workaround. And yet, at least in the case of google, it should work. you can see section 4 in this article