How to Remove Spam Links from Blogger Comment?

How to Remove Spam Links from Blogger Comment?

How to Remove Spam Links from Blogger Comments?

Welcome! to my AsifKamboh.com blog, At this point, I will explain, disable the active link and convert it to straight text, Just replace the comment link with a custom text, And Convert all text of spam-linked comments to plain text.

There are a few different ways to remove or disable links from comment contents, yes users can do this using CSS, JavaScript, and JQuery code. Blog website users can remove comments links on their blog from the following aspects.


What Are Spam Links?

Spam links in the posting of out-of-context links on blogs, discussion forums, blog comments, guestbooks, or any other online location that displays user comments. Spam links are also called spam comment links, blog spam, or wiki spam. And the Spammers usually don’t leave comments of any value along with their links.

This is an example of an active spam link in a Blogger blogspot comment.

Image of a spam link comment.


How to Disable Comment Links and Convert Them to Plain Text?

Add one of these three (CSS, JavaScript and JQuery) codes in your blog theme. I suggest you use the CSS method to disable the active link in the comments.

1. CSS Method.

Open Blogger Dashboard > Themes Menu > Click on the Three Dots and click the Edit HTML option, and then add the following CSS code before the </head>.

<style type='text/css'>
/* Asif Kamboh - www.asifkamboh.com */
.comment-content a{pointer-events:none;cursor:default;text-decoration:none;color:black}
</style>


When you have successfully added the CSS code to your Blogger theme, then click the Save Theme button and see the result on your blog.

2. JavaScript Method.

If you want to use the JavaScript method to disable active links in the comments section, add the JavaScript code below to your blog theme before "</body>".

<script> //<![CDATA[
/* Asif Kamboh - www.asifkamboh.com */
content = document.getElementById('comments').getElementsByTagName('p');
for (var i = 0; i < content.length; i++) {
 if (content[i].innerHTML.indexOf('</a>') !== -1) {
 content[i].innerHTML = content[i].innerHTML.replace(/<a[^>]*>|<\/a>/g, "");
 }
}
//]]> </script>


After adding the above JavaScript code to your Blogger theme, then click the Save Theme button and see the result on your blog.

3. JQuery Method.

If you want to use the JQuery method to disable active links in comment content, add the JQuery code below to your blog theme before "</body>".

<script> //<![CDATA[
/* Asif Kamboh - www.asifkamboh.com */
$(function(){$('#comments p').find('a').contents().unwrap();});
//]]> </script>


After adding the above JQuery code to your Blogger theme, then click on the Save Theme button and see the result on your blog.

When you add one of the above codes to your blogspot blog, the active link in the comment content will be disabled and the comment will look like this.


The image of the spam link comment content whose link has been disabled, and has been converted to plain text.


How to Disable Comment Links and Convert Them to Custom Text?

Go to Blogger Dashboard > Themes Menu > Click on the Three Dots and click the Edit HTML option, and then add the following CSS code before the </head>.

Replace the "Link Removed" highlight text in the code below with your custom message before adding the code to your theme.


<style type='text/css'>
/* Asif Kamboh - www.asifkamboh.com */
.comment-content a{pointer-events:none;cursor:default;text-decoration:none;color:black}
.comment-content a{visibility:hidden;font-size:0}
.comment-content a:after{visibility:visible;content:"Link Removed";color:black;font-size:14px}
</style>


When you have successfully added the above CSS code to your Blogger theme, then click the Save Theme button in the top right corner.

After that, all active links in the comments on all your blog posts will be disabled and the contents of all these links will be replaced with your custom text, and the content of the comments will look like this.

Image of content with spam link comment whose link has been disabled, and the content of that link has been replaced with custom text.


How to Replace All Spam Link Comment Content with a Custom Text?

Go to Blogger Dashboard > Themes Menu > Click on the Three Dots and click the Edit HTML option, and after that add the below JavaScript code to your blogger theme before the "</body>" tag.

Replace the "Oops! You cannot enter comments with active links on this site. All comments, including links, are automatically disabled on this website." highlight text in the code below with your custom message before adding the code to your theme.


<script> //<![CDATA[
/* Asif Kamboh - www.asifkamboh.com */
var content = document.getElementById('comments').getElementsByTagName('p');
for (var i = 0; i < content.length; i++) {
 if (content[i].innerHTML.indexOf('</a>') !== -1) {
  content[i].innerHTML = 'Oops! You cannot enter comments with active links on this site. All comments, including links, are automatically disabled on this website.';
 }
}
//]]> </script>


When you have successfully added the above code to your Blogger theme, then click the Save Theme button in the top right corner.

After that, the contents of all the comments that contain links to all your blog posts will be replaced with your custom text message, and the content of the comments will look like this.

Image of content with spam link comment whose link has been disabled, and the content of that comment has been replaced with a custom text message.

I hope you find this post "How to Remove Spam Link from Blogger Comment?" very useful and respectful.
Load comments