Google documents exactly how to inject canonical tags using JavaScript

Google has upgraded its JavaScript SEO help document to include technical information on how to infuse approved link tags using JavaScript. Google included a new section labelled “properly inject rel=”canonical” web link tag.”

What is brand-new. Below is the brand-new section where Google recommends not to implement your canonical tags making use of JavaScript, but if you must, Google describes this is the proper method to do so. Google composed:

While we do not recommend using JavaScript for this, it is possible to infuse a rel=”approved” web link tag with JavaScript. When rendering the page, Google Search will certainly pick up the infused approved URL. Here is an instance to infuse a rel=”approved” link tag with JavaScript:

google documents how to inject canonical tags using javascript
Google documents exactly how to inject canonical tags using JavaScript

Google added this warning mentioning”When using JavaScript to infuse the rel= “canonical “web link tag, see to it that this is the only rel=”canonical” web link tag on the page. Wrong applications may create several rel=”canonical” link tag or alter an existing rel=”canonical” link tag. Contrasting or numerous rel=”canonical” web link tags might cause unexpected results.”

Hit or miss. We have actually seen situations where Google can grab these canonical tags or various other ingrained elements, even structured information, making use of JavaScript. It can be struck or miss out on, so it is recommended that if you are going to make use of JavaScript especially to inject your approved tags, comply with these directions specifically.

Why we care. Once again, if you are injecting approved tags making use of JavaScript, Google has ultimately formally recorded the appropriate means to implement it. Inspect the documentation over here and also ensure your implementation follows Google’s recommendations.

The article Google documents how to inject approved tags utilizing JavaScript appeared initially on Search Engine Land.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.