Last active
February 28, 2020 14:22
-
-
Save luizfaias/9abab5754c0b08bb7c76b73abb9ea5bb to your computer and use it in GitHub Desktop.
Adds the noindex meta tag to all pages on the Help Center, except the home page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
//prevents all pages, except the home page, from being indexed by search engines | |
if(window.location.pathname.match(/\/hc\/(.*)\/([a-z])/)) { | |
var meta = document.createElement('meta'); | |
meta.name = 'robots'; | |
meta.content = 'noindex'; | |
document.getElementsByTagName('head')[0].appendChild(meta); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment