Google Explains How To Inject Canonical Tags Utilizing JavaScript



Google has up to date its JavaScript search engine marketing assist doc so as to add a new part on the best way to correctly inject canonical hyperlink tags utilizing JavaScript. The doc says Google doesn’t suggest utilizing JavaScript for this, nonetheless “it’s potential to inject a rel=canonical hyperlink tag with JavaScript.”

The assistance doc provides that “Google Search will choose up the injected canonical URL when rendering the web page.”

A word Google made is that “when utilizing JavaScript to inject the rel=”canonical” hyperlink tag, make it possible for that is the one rel=”canonical” hyperlink tag on the web page. Incorrect implementations would possibly create a number of rel=”canonical” hyperlink tag or change an current rel=”canonical” hyperlink tag. Conflicting or a number of rel=”canonical” hyperlink tags could result in sudden outcomes.”

Here’s a code instance of how to do that:

Beforehand, as Google is doing now, Google warned towards doing it this manner however did say it could possibly work.

Discussion board dialogue at Twitter.



Please enter your comment!
Please enter your name here