Skip to content

Instantly share code, notes, and snippets.

@jrosell
Created December 19, 2018 14:27
Show Gist options
  • Save jrosell/d8de6192a49b9ff769e2cb75a9d7d295 to your computer and use it in GitHub Desktop.
Save jrosell/d8de6192a49b9ff769e2cb75a9d7d295 to your computer and use it in GitHub Desktop.
<script>
element = document.querySelector('meta[name="robots"]');
if(element!=null){element.parentNode.removeChild(element);}
container = document.getElementsByTagName('head')[0];
newElement = document.createElement('meta');
newElement.setAttribute('name', 'robots');
newElement.setAttribute('content', 'noindex');
container.appendChild(newElement);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment