Blogger by default, and other blogging software such as WordPress, automatically adds the "nofollow" microformat extension to all links from user generated content. User generated content is defined as comments or external sources such as linkbacks and trackbacks.
I support the people of the blogging community who have chosen to remove NoFollow for blog comments and linkbacks/trackbacks. If you are reading this right now, you too are probably thinking about joining us yourself. It would be a good move, read on to find out why.
If you are using the New Blogger Layout style on Blogspot, then you will need to use the Remove Nofollow from Blogger Layouts tutorial instead. This tutorial is for Classic FTP Blogger pages only.
Before We Begin
This removal procedure applies to the Classic FTP Blogger only. It is impossible, at this time, to remove NoFollow from Classic Blogger templates that are hosted at Blogspot. This is due to the fact that those templates use the variable <$BlogCommentAuthor$> which encapsulates the anchor link around linking text. Outside of petitioning Blogger to allow us the option for using "NoFollow", there is nothing that can be done.
This article also assumes that you have enabled your Html pages to process PHP script. If you have not done so already, visit the Parsing Html as PHP article before proceeding.
Nofollow Removal Process
The process to remove NoFollow is two-pronged and involves working with your template at Blogger and FTP access to upload a small PHP script.
We will first create an includable PHP script and FTP that to your server. The PHP script will do the actual work of stripping the rel="nofollow" attribute from your links.
In order for your the script to be processed, we will be revising your template to insert a few PHP directives. Also, we will isolate the portion of your code where the <$BlogCommentAuthor$> variable appears in your comments area and capture that variable into one that is recognizable by PHP.
Let's get started.
Creating the PHP Script to Remove NoFollow
I created an includable PHP file named pfblogger_functions.php. Inside of this file is a function named strip_nofollow(). There is another function in the file and more will be added as time progresses. All you need to concern yourself with is just the one function for right now.
Open up the blogger functions script in your browser. Using your favorite Html editor or Notepad, create a new file. Copy and paste the text from your browser screen into the new file, and save it with a name of pfblogger_functions.php
Upload the new PHP file via FTP to your server. I suggest uploading it into your "includes" directory if you have one. If not, then create a new directory on your server with the name of "includes". It keeps things neater this way.
Now that you have your PHP file installed, let's get on to the fun part!
Hacking PHP into your Blogger template
This portion of the tutorial may look a little daunting, but it really isn't. Just take your time and doublecheck your work.
Warning: Before beginning this procedure -- backup your template.
Navigate through your Blogger dashboard to Template > Edit Html
At the very beginning of your template, insert the following code:
$site_rootpath = "../";
$site_rootpath = "../../";
$site_rootpath = "../../../";
include ( $site_rootpath . "includes/pfblogger_functions.php" );
Everything between the <$php ... $> markers will be run through the PHP interpreter on your server. The define statement at the beginning is for hacking security.
The rest of the code uses Blogger Conditional Tags to establish the actual path to your domain root and stores that in a variable. That variable is used with the path to your include file. If the your path to the function file is different, revise this portion of the code accordingly.
We have now properly included our function file, now let's proceed to the good part.
With your template do the following:
and replace with:
<?php strip_nofollow( '<$BlogCommentAuthor$>' ) ?>
and replace with:
<?php strip_nofollow( "<$BlogCommentBody$>" ) ?>
UPDATE: The code that acted on the comment body worked fine until somebody used a 'double quote' in their comment. This was due to the fact that I enclosed the variable <$BlogCommentBody$> with double quotes and it broke the code. I am working on a fix. If you have installed this hack, then revert this portion of the code back the way it was.
Save Template Changes, but do not replish just yet. We want to test that everything went as planned first.
Navigate to Posting > Create and enter a Test Post. Publish the post and view your blog in your browser.
Enter a comment for the post. Go back to view the post and verify that your Comment Author link is now free of the NoFollow attribute. You can verify this by several means -- one is View > Page Source from your browser menu. If you are using Firefox, there are extensions and other menu options for viewing/identifying links that have Nofollow attributes.
One last step
In order for this change to have any effect, you will have to republish your entire blog. This will rewrite all of the Main, Item and Archive pages with your new code. If your blog is large, a few hundred posts or more, this could take quite a while to process.
If you choose to delay republishing, any new comments made to your posts (existing posts included) will have the NoFollow removed from now on.
Optional NoFollow Recommendations
Now that you are a card carrying member of the Anti-NoFollow community, would you like to hook up with other blogs that share this belief? Then join us over at BUMPzee in the No Nofollow I Follow | DoFollow community.
This NoFollow community is headed up by Andy Beard and is growing everyday. The response has been phenomenol. With hundreds of participating blogs, odds are you will link up with many blogs who share in your particular interests.