01/06/09
Paul Savage

Adding nofollow attribute to your blogroll


One of my pet peaves with WordPress is that you can’t specify all the attributes to links in your blog roll. While it’s possible to add some of the unpopular XFN relationship data to inform people about your relationship to the link, like ::

  • if you met the person you are linking to
  • it’s a link to a friend or family member
  • if you happen to have a crush the person
  • or it’s another website you own

While these are nice, they don’t normally serve much purpose for me. The XFN relationships that are of interest me are ::

  • rel=”nofollow” : for limiting the flow of pagerank
  • rel=”external”  : XHTML compliant version of target=”_blank”

So here is a quick tutorial as to how you can add these attributes to your current version of WordPress (done for version 2.7).  
 

How to add nofollow to WordPress Blog links

Warning:As with all editing of files, you should keep a backup of them before you start to change them. Believe me, it will save some headaches along the way. 

Adding the nofollow and external attributes is quick, easy and painless, here are the 3 steps.

  1. open file /wp-admin/edit-link-form.php
  2. Go to line line 193 / 194 and find
    <tr>
    <th scope="row"> <?php _e('identity') ?> </th>
     
  3. Above  that add
    <tr>
    <th scope="row"> <?php _e('seo') ?> </th>
    <td><fieldset><legend class="hidden"> <?php _e('seo') ?> </legend>
    <label for="external">
    <input class="valinp" type="checkbox" name="seo" value="external" id="external" <?php xfn_check('seo', 'external'); ?> />
    <?php _e('external') ?></label>
    <label for="nofollow">
    <input class="valinp" type="checkbox" name="seo" value="nofollow" id="nofollow" <?php xfn_check('seo', 'nofollow'); ?> />
    <?php _e('nofollow') ?></label>
    </fieldset></td>
    </tr>
     

Once you have this,  go to Links on the side bar, and now you can change existing links or add new links with these attributes.  There will now be an extra line in the Link Relationship section of your Links page.nofollow-blogroll

Why use rel=”nofollow”

This is used when you don’t particularly want to endorse a link you are linking too.  Normally a link to another page from your website, is seen as a vote for that page. And each page only has a certain ammount of voting power. If you use the rel=”nofollow” no virtual vote will be passed to the link tartget. For more info have a check for “PageRank”.

Example of controlling votes via rel=”nofollow”. If in your blog roll you have 10 links, but 2 of them are to well know services, you can choose to disable your vote to them, and to increase the effectiveness of a link to those other pages.

Why use rel=”external”

In XHTML Strict the link attribute target is not supported.  Previoulys target was used as a link attribute to open new pages, break out of frames, by using target=”_blank” , target=”_parent” etc.  Now in XHTML you need to use rel=”external”  to inform the browser that this should be a new  

Next time at BlackDog

Next week I will be discussing on how to edit your wordpress template, to just have your blog roll on your main page of your blog.

10 Responses to “Adding nofollow attribute to your blogroll”

  1. Kieran Kieran

    I have the same issue with Joomla. I recently did a post regarding nofollow tags on links such as Read More, Click here. But it’s a nightmare to manipulate links in the actual menu’s. Plus when doing a post and supplying a link, there is no real way of adding nofollow. Bit of a nightmare. Although think I got a plugin that may help.
    Good post ..

  2. Paul Savage Paul Savage

    Thanks for the kind words Kieran.

    I’ve almost given up on Joomla, and typically will ask clients if they are willing to part with such a poor / security flawed CMS. Normally once I mention security they do it.

    Nice blog btw. , subbed to the RSS.

    Cheers,
    Paul

  3. Kieran Kieran

    I agree, I won’t be using joomla again. I’ll be moving over to wordpress or using Xsitepro2 for any affiliate sites.
    Stuck with it for my blog, so ill try make it work :)

  4. Mike Mike

    Hi Paul, any idea how to selectively nofollow certain links within blogposts?

  5. Paul Savage Paul Savage

    Hi Mike,
    if you edit the HTML directly when you post, you can add the rel=”nofollow” attribute in your link code . great site

  6. Mike Mike

    Hi Paul, I was actually coming back to tell you i had worked it out, having a slow brain day ;-) Thanks for the help

    Mike

  7. Paul Savage Paul Savage

    no problem mike, if you need any other tips just pop a comment in somewhere.

  8. johnbillion johnbillion

    Hi Paul,

    Your post is a little misleading with regard to the rel=”external” attribute. The ‘external’ value is non standard and does not replace target=”blank” as a means of telling the browser to open the link in a new window.

    In fact, there is currently no standards compliant way to tell the browser to open a link in a new window (without JavaScript).

  9. Diego Diego

    Will you be doing that post about having your blogroll only on your mainpage? You stated in this article you’d do it next week, but i can’t seem to find it anywhere. This article was great, so if you could get that one up on the blogroll, I’d be ecstatic :) Thanks!

    Diego

  10. Paul Savage Paul Savage

    Hi Diego, Thanks for the reminder. I will get to that this week, I promise. I will fire you an email once it’s up here.

    Regards,
    Paul

Leave a Reply