This blog supports rel="nofollow" attribute to prevent Comment Spam

Google Blog has a nice article on Comment Spam. If you're a blogger (or a blog reader), you're painfully familiar with people who try to raise their own websites' search engine rankings by submitting linked blog comments like "Visit my discount pharmaceuticals site." This is called comment spam, we don't like it either, and we've been testing a new tag that blocks it. From now on, when Google sees the attribute (rel="nofollow") on hyperlinks, those links won't get any credit when we rank websites in our search results. This isn't a negative vote for the site where the comment was posted; it's just a way to make sure that spammers get no benefit from abusing public areas like blog comments, trackbacks, and referrer lists.

Any link that a user can create on your site automatically gets a new "nofollow" attribute. So if a blog spammer previously added a comment like

Visit my <a href="http://www.example.com/">discount pharmaceuticals</a> site.

That comment would be transformed to

Visit my <a href="http://www.example.com/" rel="nofollow">discount pharmaceuticals</a> site.

Any piece of software that allows others to add links to an author's site (including guestbooks, visitor stats, or referrer lists) can use this attribute. Google is working primarily with blog software makers for now because blogs are such a common target.

Here's a sample full code listing that bloggers can use to prevent comment spam in their blogspot blogs.

<p class="comment-data">
<script language="JavaScript">
function PostComment(frm){
var name = "";
var email = "";
var url = "";

if(frm.name.value=="") {
name = "Anonymous";
} else {
name = frm.name.value;
}

frm.postBody.value = "<a rel=\"nofollow\" href=\"" + frm.url.value + "\" title=\"" + frm.email.value + "\">" + name + "</a> wrote: " + frm.Comment.value;
frm.submit();
}
</script>

<form name="CommentForm" action="http://www.blogger.com/add-comment.do" method="post">
Name: <input name="name" type="text" size="30"> <br>
Email: <input name="email" type="text" size="40"> <br>
URL: <input name="url" type="text" size="35"> <br>
<textarea name="Comment" rows="10" cols="40"></textarea>
<br>
<input type="button" onClick="PostComment(document.CommentForm)" value="Post your comment">
<input type="hidden" name="blogID" value="7687465">
<input type="hidden" name="postID" value="<$BlogItemNumber$>">
<input type="hidden" name="anonymous" value="y">
<input type="hidden" name="postBody" value="">
</form>

Find this article at: http://labnol.blogspot.com/2005/01/this-blog-supports-relnofollow.html

web: http://www.labnol.org/ email: amit@labnol.org

Reader Comments

Digital Inspiration wrote: Only Google is reported to have implemented this action. Hope everybody else follows their lead.

Blog Outer wrote: A nice way to visualize which links use the new "nofollow" relation is to include a special user-stylesheet into Firefox. To do so, you need to install the Web Developer extension (unfortunately, Firefox doesn't allow an easy way to include user-stylesheets via the native menu).
Once you've got this extension running (this needs a restart after installation) you can right-click any page and select Web Developer -> CSS -> Add User Style Sheet. Now you select a simple text file with the extension *.css (you may want to call it "user.css" and put it right on the desktop), in which you saved the following lines:

a[rel="nofollow"]
{
background-color: red !important;
color: white !important;
font-weight: bold !important;
text-decoration: none !important;
}

John wrote: Try this instead:

javascript:document.location=targetURL

WhyNot wrote: Hello Amit,

Although our blog hasn't yet been inundated by spam, I guess it is only a matter of time, and so I'm very keen on implementing your suggested code addition.

I'm not very savvy in blog templates to say the least, and I was wondering if you could advise as to where your code in the template should be placed.

In case it's relevant, we use a Blogger standard template (the Spotted one) to which I did some minor editing.

Also, we use both the "comment" and "recent comment" add-ons by BloggerHacks.

Hoping you can help,

Thank you

Amit Agarwal wrote: I would be more than happy to assist you.

Either you can send me your template and I can do the necessary changes or better if you want my template, I can mail that to you.

Cheers,
Amit.

I use technorati tags in my posts, and don´t want to lose pagerank on them. Do I have to put nofollow, or they are ignored because they have rel="tag"?

I read in other blogs that Blogger has some disadvantages and they advice to have your own domain. What do you think? Why do you use Blogger?

I really like your blog, thanks in advance.

John, rel="nofollow" is generally used for external hyperlinks while technorati tags are used with keywords.

Why would you not want Google to index your pages?

Sorry if I´m talking nonsense, but I´m a beginner.

I think that you lose a bit of PR with every link that you use. Technorati tags have this form: argentina, so they are external links. If you have a lot of outbound links, you would lose PR, and tags tend to be numerous. That´s why I want to know if it´s better to add rel="nofollow" to the tags or not.

Thanks

Amit, have you considered that if you do Javascript-based link editing, a spammer can bypass it by simply turning off Javascript when they post?

Ya, but if he turns JavaScript off, the comment won't be posted at all since the PostComment function is based on JS.

« Back to main



Google Custom Search