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.


Opinions expressed in this article are those of the guest author and not necessarily Search Engine Land. Staff authors are listed here.


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.