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.
Written on 22/1/05 11:10 AM
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;
}
Written on 22/1/05 8:55 PM
John wrote: Try this instead:
javascript:document.location=targetURL
Written on 26/1/05 1:59 PM
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
Written on 4/2/05 5:12 AM
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.
Written on 4/2/05 9:38 AM
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.
Written on 15/4/06 5:47 AM
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?
Written on 15/4/06 8:28 AM
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
Written on 16/4/06 6:38 AM
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?
Written on 23/5/06 12:19 AM
Ya, but if he turns JavaScript off, the comment won't be posted at all since the PostComment function is based on JS.
Written on 23/5/06 8:38 AM