Tuesday, May 30, 2023
HomeSEOGoogle paperwork inject canonical tags utilizing JavaScript

Google paperwork inject canonical tags utilizing JavaScript

Google has up to date its JavaScript search engine marketing assist doc so as to add technical particulars on inject canonical hyperlink tags utilizing JavaScript. Google added a brand new part titled “correctly inject rel=”canonical” hyperlink tag.”

What’s new. Right here is the brand new part the place Google recommends to not implement your canonical tags utilizing JavaScript, however in the event you should, Google explains that is the right approach to take action. Google wrote:

Whereas we don’t advocate utilizing JavaScript for this, it’s potential to inject a rel=”canonical” hyperlink tag with JavaScript. Google Search will decide up the injected canonical URL when rendering the web page. Right here is an instance to inject a rel=”canonical” hyperlink tag with JavaScript:

Google added this warning stating “When utilizing JavaScript to inject the rel=”canonical” hyperlink tag, guarantee that 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 surprising outcomes.”

Hit and miss. Now we have seen instances the place Google can decide up these canonical tags or different embedded components, even structured information, utilizing JavaScript. However it may be hit and miss, so it’s endorsed that if you will use JavaScript particularly to inject your canonical tags, comply with these instructions exactly.

Why we care. Once more, in case you are injecting canonical tags utilizing JavaScript, Google has lastly formally documented the right method to implement it. So examine the documentation over right here and ensure your implementation follows Google’s suggestions.

New on Search Engine Land

About The Creator

Barry Schwartz a Contributing Editor to Search Engine Land and a member of the programming group for SMX occasions. He owns RustyBrick, a NY primarily based net consulting agency. He additionally runs Search Engine Roundtable, a preferred search weblog on very superior SEM matters. Barry might be adopted on Twitter right here.



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments