The guide was created by Google’s Martin Splitt and Lizzi Harvey.
When Googlebot encounters “noindex” in the robots meta tag, it doesn’t render or index the page.
From this we can infer that it is possible to add a robots meta tag/attribute to a page, as long as the page does not already have a robots noindex tag – because in this case Google will not render or index the URL in the first instance.
We wanted to be 100% sure of this, so submitted feedback to Google via Twitter that the documentation could be a little clearer.
Barry Schwartz at Search Engine Roundtable pushed the feedback direct to Martin and Lizzi.
Martin Splitt replied, confirming that this interpretation is correct – that yes, it is possible to add or change a meta robots tag – as long as the page doesn’t already have a noindex meta robots tag in place.
Thanks, that’s great feedback! We will make this clear. You can use JS (also without jQuery) to add or change the robots meta tag. The exception is using JS to change the tag when it was initially “noindex”, because rendering is skipped then.
Update (13th August 2019): Google have updated the JS SEO Basics document to include a clear statement on JS meta noindex usage, and an example.
Direct from the docs:
You can prevent Googlebot from indexing a page or following links through the meta robots tag.
Also an example usage is included on the page, whereby a meta noindex tag is supplied via JS after an API fails to provide a response.