Can JavaScript override a nofollow meta tag?

Suppose you find yourself in a situation where you want Google to index certain pages, but you are required to use a template that uses the “nofollow” robots.txt meta tag. Can you use JavaScript to remove the tag when the page is fully rendered so that Google will index it? This question was recently posted […]

Chat with SearchBot

Suppose you find yourself in a situation where you want Google to index certain pages, but you are required to use a template that uses the “nofollow” robots.txt meta tag. Can you use JavaScript to remove the tag when the page is fully rendered so that Google will index it?

This question was recently posted in the TechSEO subreddit. John Mueller, Google Senior Webmaster Trends Analyst, responded that Google will use the most restrictive setting you have on the page, regardless of how it’s included.

Using the “noindex” tag is just about the most restrictive condition you can apply to a page — you are literally telling Google to ignore the page. If a page has a “noindex” in static HTML, and JavaScript is used to remove it when the page is rendered, Google will still see the “noindex” and comply with the request.

“Noindex” overrides other robots.txt meta tags as well. For example, if you have a “noindex” + “index”, then the “noindex” will override the “index.” Moreover, if a page doesn’t even have any meta tags, and for some reason you use JavaScript to add a “noindex” tag, Google will honor the “noindex” request.

The bottom line: JavaScript can be a very powerful workaround for many limitations or requirements, but in the case of “noindex” it simply won’t work to cancel out the impact of a noindex meta tag embedded in a template.


Contributing authors are invited to create content for Search Engine Land and are chosen for their expertise and contribution to the search community. Our contributors work under the oversight of the editorial staff and contributions are checked for quality and relevance to our readers. The opinions they express are their own.


About the author

Chris Sherman
Contributor
Chris Sherman (@CJSherman) is a Founding editor of Search Engine Land and is now retired.

Get the must-read newsletter for search marketers.