How To Add Nofollow to the WordPress Comments Link
July 5th, 2008I actually had a damn hard time finding this posted anywhere on the web, so I thought I would share.? I don’t think I need to tell anyone why this is a good idea, but it is basically eliminating search engines from indexing useless links. We will use the following as an example.
Useless Links For Search Engines (possibly dup content)
http://www.lobolinks.com/blog/which-search-engine-had-the-best-4th-of-july-display/#respond
http://www.lobolinks.com/blog/entrecard-suggestions/#comments
I think you see my point.
How To Instructions
Open wp-includes/comment-template.php
Find (was around line 763 for me)
[php] echo ‘ title=”‘ . sprintf( __(‘Comment on %s’), $title ) . ‘”>’;[/php]
Change To
[php] echo ‘ title=”‘ . sprintf( __(‘Comment on %s’), $title ) . ‘” rel=”nofollow”>’;[/php]
Save and Upload.? You’re done.
Related Post
- Forcing the WordPress index.php to the Main Url and Avoiding Duplicate Content with a .htaccess - Duplicate Content on a large scale basis can ruin your blog. I blame it on the search engines for not being smart enough to know exactly what yo ...
- 301 redirects for Directory Owners - Earlier today I was checking on some new links for the directory and some old ones. I ran across a blog post from Links Juice Blog by eazenet. Eaze wa ...
- Adding Facebook to Sociable 2.0 For WordPress - After posting the instructions for adding mixx to sociable 2.0., Matthew Peters from Pandemic Blog requested the needed code for facebook. I ho ...

By Squeaky on Jul 6, 2008 | Reply
Thanks for the very useful code. I think this will work rather well, but if I would ever decide to let registered users post have the follow tag on their comments, then it would be an issue to address.
Since I am rather new to blogging, not sure if it is important to allow a follow tag on registered users comments, if it is something to consider?
By Mack on Jul 6, 2008 | Reply
Squeaky, their are lots of dofollow plugins for WordPress that will allow you to control what is followed.
http://kimmo.suominen.com/sw/dofollow/
Even if you have one of the dofollow plugins it shouldn’t conflict with this hack.
By Dennis Edell on Jul 8, 2008 | Reply
I’m a little confused. On the links you gave, are you referring to the duplicate “related posts” entries?
By Mack on Jul 8, 2008 | Reply
Well lets compare the urls, this is the normal permalink.
http://www.lobolinks.com/blog/how-to-add-nofollow-to-the-wordpress-comments-link
This is the one to jump straight to comments.
http://www.lobolinks.com/blog/how-to-add-nofollow-to-the-wordpress-comments-link/#comments
The problem is, search engines will see that as two different urls. So, we need to eliminate one of them with nofollow. We would all like to think the “bots” are smart enough to know the difference, but probably not.