How To Add Canonical and HREFLANG Markup To Your Site Using JavaScript

Recently I joined a google webmaster central office hours hangout where I asked the question:

“…is implementing hreflang and then modifying a canonical tag using JavaScript. So you see that being an issue or something that Google would recognize?”

John replied suggesting that it “could work” however instead of swaping canonical or hreflang tags between static HTML and rendered HTML, ensure the static HTML version would not have those signals from the start and insert them using JavaScript.

“What I might do in a case like that is just not provide a canonical in the static HTML version and then add one with JavaScript, so that signal is clear, like, this is the only signal that we have”

My question recently got featured in an article on SEO Round Table so I’m happy to see this answer may help out other SEO’s as well!

Introducing admin

Darcy Burk has written 4 post in this blog.

Darcy is an SEO Specialist & Code Monkey. He is passionate about the ever evolving, all knowing, mega communication tool called the internet.

There are no comments published yet.

Reply.

giganews