Thursday 21 March 2019

How to Deactivate Live Links in Blog Comments



How to Disable live links in blog comments -
Aims to make the "spam" link in the blog comment column not damage the reputation of the blog in the eyes of search engines. Because the more outbound links are not qualified out of our blog, then that will have a bad impact on our blog later.

Usually the active links left by spammers in the comments are in the form of promotions, backlink searchers, and so forth. But in reality this is not the only way to find backlinks, since the backlinks themselves will come to our blog that we find useful.

To deactivate live links in blog comments, we only need to implement some javascript code, and you can replace the live links in your blog's comments column with normal letters or in the form of a warning.


Here I will give two ways, namely :

The first way, replace the live link in comments with normal writing

First open the blogger > Template > Edit HTML > Copy and implement the code below before </body>

<script type='text/javascript'> //<![CDATA[ $(function(){$('#comments p').find('a').contents().unwrap();}); //]]> </script>


The second way, replace the live link in the comment by adding a warning.

<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; }

and Save the template.



For the second way, the words on Javascript and CSS can be adjusted to your liking.
Disqus Comments