Menu

How to Remove Blogger Comment Hyperlinks

Taufik Nurhidayat
2 min read
#blogger #tutorial #programming

Hello, Blogger friends, this time we will discuss hyperlinks that often appear in Blogger comments. These hyperlinks are usually spam links that are intentionally sent so that people click on them. It's fine if the link is something useful, but if the link is not good, then we need to prevent it by removing hyperlinks in our Blogger comments.

social_cards/thumbnail-text-editor.png

Hello, Blogger friends, this time we will discuss hyperlinks that often appear in Blogger comments. These hyperlinks are usually spam links that are intentionally sent so that people click on them. It’s fine if the link is something useful, but if the link is not good, then we need to prevent it by removing hyperlinks in our Blogger comments.

Usually, to change a link, you need the JavaScript library JQuery, but how do you remove hyperlinks in Blogger comments without JQuery?

You need to log in to your Blogger account and edit the theme in HTML mode, which can be accessed from Theme > three dots > Edit HTML. Now, paste the following code right above the </body> tag.

<b:if cond='data:view.isSingleItem'>
<script type='text/javascript'>
document.querySelectorAll(".comment-content a").forEach(function(el){el.removeAttribute("href");el.setAttribute("class","text-danger");el.innerHTML = "Disabled"});
</script>
</b:if>

The text-danger part is the class of the text, and Disabled is the text that replaces the link. Change this class to your desired class, then save the template and see the result.

Hyperlinks in comments will be removed and replaced with the word “Disabled.”

This JavaScript code to remove hyperlinks in Blogger comments is simple and does not require JQuery. It is highly recommended if you do not need the JQuery library, as you know that using the JQuery library can make blog loading a bit heavy.