Make WordPress Comments DoFollow

In WordPress the links on any comment made on posts have the HTML attribute of NoFollow by default.  What this simply means is that it tells the search engines that a hyperlink will just ignore or not influence the target’s ranking in the search engine’s indexing.  If you are not familiar with it, the attribute should look like this within the tag if you look at the source:

<a href='http://link_of_site_here' rel='external nofollow' class='url'>

The highlighted part of the <a> tag is how WordPress writes the link.  If you want to change this to something else,  like the ever popular DoFollow attribute, there are 2 ways of achieving this.

1) Hacking Your Wordpress – The first method is to “hack” the source code of your WordPress blog.  It is very easy and doesn’t involve any programming know-how.  All you need to do is to find and edit the file named  comment-template.php.  This should be easily found under the wp-includes directory of your WordPress installation.

Once you’ve found this file, open it with your favorite editor then go to the function named get_comment_author_link() as seen below:

function get_comment_author_link() {
 $url    = get_comment_author_url();
 $author = get_comment_author();

 if ( empty( $url ) || 'http://' == $url )
 $return = $author;
 else
 $return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
 return apply_filters('get_comment_author_link', $return);
}

Again take note of the highlighted part on the code above.  That is the part that you should edit.  There is actually no DoFollow attribute.  Instead taking out the nofollow from the code is all you need to do.  After you’ve done the necessary changes, the result should look like this:

 $return = "<a href='$url' rel='external' class='url'>$author</a>";

Save the file, upload it to your host server and you’re good to go!  Do note that this will only take out the nofollow attribute on the “author link” part of the comment.  Links on the body of the comment will stay the same – NoFollow.  But that is good since we do hate links dropped on the comment body don’t we? It looks too spammy.  Most of the time this kind of comment goes directly to the spam bin.  If you want to make all links made on the comment DoFollow, you’ll have to do more hacking.  However, I don’t recommend this method of making comments on your blog DoFollow.  Directly altering WordPress code is something you should avoid doing since this breaks on version upgrades.

By the way, External, in case you were wondering is an attribute that tells your browser to open the link in another page or tab.  It is the valid XHTML strict equivalent to target=’_blank’, which is not supported.  This, however, needs javascript to function properly.

2) Plugins – The 2nd method, and what I recommend, is to install a WordPress plugin to take care of making links on comments DoFollow.  There are several plugins available at the WordPress plugins page.  Or you can search for it directly from the control panel.  Keyword for the search? Dofollow of course!  I will leave it up to you to decide which plugin best suits your taste

How does a DoFollow link benefit you?  Well for one you should be getting more comments from people who are trying to build backlinks to their site.  (More traffic perhaps?)  I see this as a 2-way benefit too.  You comment on my site, I follow.  I do the same on your site.  Well if you’re not a believer of DoFollow, at least approve our comment. LOL!

Anyway, DoFollow encourages commenting on your posts but be warned that spammers love DoFollow blogs a lot.  Once you have enabled this, expect to see more spam comments on your site.  Of course you wouldn’t be running a blog without some form of spam protection, would you?

You can leave a response, or trackback from your own site.

9 Comments »

 
 

We love comments. However, comments will be moderated. Most may have to be reviewed manually and subject to approval. Please write your comments in english. It doesn't have to be perfect grammar as long as it's understandable. Non-english comments will most likely be ignored. Make your comments relevant and related to the subject. Anything out of topic will most likely end up in the spam bin. Comments with links within the body of the comment will have that link removed, and/or if the comment is not related to the subject at all, it will be marked as spam. Thanks! :)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>