How to Disable Link Living or Spam in Blog Comments - KhalistaBlog -->
Skip to content Skip to sidebar Skip to footer

How to Disable Link Living or Spam in Blog Comments

How to Disable Link Living or Spam in Blog Comments- Disables live links in blog comments, it is intended that spammy links in the blog comment field do not damage the blog's reputation in the eyes of search engines. As more and more outbound links are not qualified out of our blog, then it will be bad for our blog later.

Usually the active links left by spammers in comments are in the form of promotion, backlink seekers, and so forth. But in essence the way is not the only one to find backlinks, because the backlink itself will come to our blog that felt useful.

How to Disable Link Living or Spam in Blog Comments

To disable live links in blog comments, we just need to apply some javascript code, and you can replace the live links that are in the comment field of your blog with ordinary letters or in the form of a warning.

In the article I'm sharing this time, I'll give you some ways to Disable Live Links in Blog Comments that are often called spam. But the way I will share it there are two kinds, and you can choose one of them, for more details can be directly refer to the following way.

1. Replacing Living Links on Comments with Ordinary Writing


Go to Blogger Dashboard >> Template >> Edit HTML, Then Save the code below just before the code </body>
<script type='text/javascript'>
//<![CDATA[
$(function(){$('#comments p').find('a').contents().unwrap();});
//]]>
</script>

Then copy and apply the code below before </style>
.spammer-detected {
    font-size: 14px!important;
    color: #fff!important;
    background: #5cb0d8!important;
    margin: 25px;
    border-radius: 4px;
    display: inline-block;
    padding: 10px 15px!important;
}

Then Save Template

2. Replacing Living Links on Comments by Adding Warnings


Go to Blogger Dashboard >> Template >> Edit HTML, Then Save the code below just before the code </body>
<script type='text/javascript'> //<![CDATA[
function blockLinks(parentID, children) {
var parent = document.getElementById(parentID),
content = parent.getElementsByTagName(children);
for (var i = 0; i < content.length; i++) {
if (content[i].innerHTML.indexOf('</a>') !== -1) {
content[i].innerHTML = "<mark>Do not Include Live Links!!</mark> Spam is not allowed!";
content[i].className = "spammer-detected";
} } }
blockLinks('comment-holder', 'p');
//]]>
</script>

Then copy and apply the code below before </style>
.spammer-detected {
    font-size: 14px!important;
    color: #fff!important;
    background: #5cb0d8!important;
    margin: 25px;
    border-radius: 4px;
    display: inline-block;
    padding: 10px 15px!important;
}

Then Save Template

Those are tips on How to Disable Link Living or Spam in Blog Comments. Hopefully with this short enough article can be useful and useful for us all. Good luck.

Post a Comment for "How to Disable Link Living or Spam in Blog Comments"