Dealing with visitors links in blogger comments

Dealing with visitors links in blog comments


Dealing with visitors links in blogger comments

Are you bothered by the links that visitors put inside your blog comments? I will offer you a set of solutions to deal with it without having to delete it. The comments section affects one way or another the arrangement of your blog and the strength of its archiving. We know that one of the simplest ways to bring visits to the site is to publish its link in a group of places, including comments.


This strategy is usually beneficial to the comment owner, but it is likely to be harmful to the owner of the site as losing visitors instead of browsing the rest of the content.


Perhaps some will ask a question why I do not delete the comments in which the links are manual, the reason is simply that sometimes visitors add comments related to the post and of high quality, but add defamatory links to it, in this case, we do not want to delete all the comment, but we want to hide the link only.


I will present to you a set of different scripts, each of which deals with links in the comments in a different way, and I will leave you the opportunity to choose the script that is suitable for you.




Methods that can be used

  • Open links in a new window without deleting them
  • Change link to text
  • remove link



How to install the script

  1. First, we edit the HTML.
  2. Take a backup to get back to it if you encounter an installation problem.
  3. Find </body> and place the script of your choice before it. 


Choosing the right script for you


Open links in a new window without deleting them

The first script makes the links open in a new window without removing them, and this is the best solution I recommend:

<script type="text/javascript">
/*<![CDATA[*/
$('p.comment-content a').each(function() {
  $(this).attr('target','_blank');
});
/*]]>*/
</script>





Or

Change the text of the links in the comments

The second script changes all links to the text of your choice, you can change the word removed with any text you want:

<script type="text/javascript">
/*<![CDATA[*/
$('p.comment-content a').each(function() {
  var alt = "removed";
  $(this).wrap('span').closest('span').text(alt);
});
/*]]>*/
</script>



Or

Remove link

The third and final script completely removes links from the comments. To install it, you can use the following script:

<script type="text/javascript">
/*<![CDATA[*/
$('p.comment-content a').each(function() {
  $(this).remove();
});
/*]]>*/
</script>


After placing the script above the </body> tag, save the template and then check that the script works, if it does not work, there are two possibilities, the first possibility is that you need to add the jQuery library to your blog, and this is a small possibility because the jQuery is used in most blogs, and the second possibility Is that your blog uses the comment version that cannot be answered, as there are 2 copies of the comments, the first version can reply to add responses and the second version can not.



Comments