I have a component which makes a promotion "expire" after a certain date, when it expires I want to add a NO FOLLOW NO INDEX meta tag via JS.
The question is would Google stop indexing this page as the NO INDEX comes after page load(with the JS)
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.Sign up to join this community
My advice is: Run some tests or check to see if the promotion has expired using a server-side language. Example with PHP:
<?php if($promoExpired): ?> <meta name="robots" content="noindex, nofollow"> <?php endif; ?>
<head> has been downloaded. You should use PHP or manually edit the HTML after the promotion.
No index works but its not like instant coffee
You should also note that Google does not instantly remove pages when you use no-index or robots.txt to block Google. Also, Google will need to visit the site to actually find that you no longer want it indexed, depending on how many crawls you get a week will determine when Google first notices the no index, another issue could be is that Google doesn't always honor the no-index on the first crawl discovery, it does this to prevent web masters accidentally removing high ranking pages from the index.
Request the page to be removed using Webmaster Tools
The best solution would be to use a no-index, robots and request the page to be removed via Webmaster Tools using the URL removal tool, or just update the page with a notice sorry this promotion has now ended and use a 410 gone return.