Last active
August 26, 2022 08:17
-
-
Save Naba0123/18a2e042e8971d4cdc4bf47ca1a81568 to your computer and use it in GitHub Desktop.
noindex hatena blog
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"> | |
window.addEventListener('DOMContentLoaded', function() { | |
<!-- NOINDEX --> | |
if (document.getElementsByTagName("body")[0].classList.contains("category-noindex")){ | |
console.log('add noindex'); // noindex が追加されているかの確認用。不要なら消してください。 | |
var head = document.getElementsByTagName("head")[0]; | |
var meta = document.createElement("meta"); | |
meta.setAttribute("name","robots"); | |
meta.setAttribute("content","noindex"); | |
head.appendChild(meta); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks