Graphic Motion Video Art, Website, IT Network, Culture

Loading...
Are you a blogger who is very much concerned about the one of blog component? When a blog or a website already has a lot of visitors, many people want to put the links to your blog or website. One which became users or spammers targets who want to take advantage of our blog / website is the comment component. When comments are not equipped with rel="nofollow" inside anchor link. This is a great opportunity for users and spammers who want to increase the page rank of their url in our page rank.


Blogger itself have prevent spammers has benefits who want to get credit to your blog. Which by default is already implementing rel="nofollow" inside the anchor tag comments, but this still allow the users to add links to their comments, but in this case the links will not get credit to increase of their url in our page rank. Make sure your blog have completed with rel="nofollow" attribute to the comment content. This following picture is how blogspot especially has been implemented rel = "nofollow" attribute from the anchor tag comments from the source code of the template blog.


However sometime the users or spammers will try to put many url links as they want inside the comments even the links doesn’t related with the content post. Ironically many users or spammers give any comments just want to put their links, If you don’t want the users or spammers put any links inside the blog comments, you can remove by disable the href link using javascript. Find the jquery.min.js link whatever the version that you have used on your blog template code and add the javascript below after jquery.min.js link!

<script type='text/javascript'>
 var a = $(this);
 var href = a.attr('href');
 $(document).ready(function() {

 $(".comment-content a[href^='http://']").each(function () {
 if(this.href.indexOf(location.hostname) == -1) {
 $(this).removeAttr("href");
 }
 }
 );
 $(".comment-content a[href^='https://']").each(function () {
 if(this.href.indexOf(location.hostname) == -1) {
 $(this).removeAttr("href");
 }
 }
 );
 });
</script>
Remove the Url Link on Blog Comments using javascript

The above picture is how we put the javascript code in order to disable the url links on blog comments inside the scripts of the blog template code. After we save it, this new javascript code will be parsed automatically. In this way the url links that inserted by the users will be changed into a plain text. This will reduce the users give the comments just want to put any links as their main purpose. Comments with many URL links can be disturbing the substantive comments itself. In large numbers the url links will lose the focus to the author and actual users in related with the main content itself.


This is the way if you want to adjust the url links of blog comments position that have disabled so as not cluttered. Add css rule as you like .comment-content a { } or if it is necessary add disabled class to adjust it more specific.

And as alternatively the following script works most effectively you can use it before the body tag end

<script type='text/javascript'>
$('.comment-content a[rel$=nofollow]').replaceWith(function(){return($(this).text());});
</script>

Share This Article :
Related Articles

5 comments :

Back to Top