Tuesday, May 30, 2023
HomeSEOGoogle Explains How To Inject Canonical Tags Utilizing JavaScript

Google Explains How To Inject Canonical Tags Utilizing JavaScript


Google has up to date its JavaScript website positioning assist doc so as to add a new part on correctly inject canonical hyperlink tags utilizing JavaScript. The doc says Google doesn’t suggest utilizing JavaScript for this, nevertheless “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 may 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 might result in surprising 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 actually work.

Discussion board dialogue at Twitter.



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments