Added information about canonical tags to the JavaScript reference document



The source – developers.google.com

Google has added a new section to the JavaScript document that explains how to properly use canonical link tags with JavaScript.

It says that Google doesn't recommend doing this, but you can insert a link tag with the rel="canonical" attribute using JavaScript.

Google will match the added canonical URL when rendering the page.

Additionally, Google warned: "When using JavaScript for a link tag with a rel="canonical" attribute, make sure it's the only such tag on the page. If there are more tags, they can lead to unexpected results.”

An example of using the link tag with the rel="canonical" attribute looks like this.

An example of using the link tag with the rel="canonical" attribute
Share

Spelling error report

The following text will be sent to our editors: