Add NoFollow Relationship to WordPress Blogroll

Discussion in 'Content Management System' started by shabbir, Nov 12, 2007.

  1. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    These days Google has been penalizing (by decreasing the pagerank) sites for placing links to other sites with rel="nofollow" tags. The step taken by Google is for flagging those sites for a main reason that they are playing with the Google search ranking algorithm and Google wants its algorithm to be as full proof as possible.

    Blogroll in WordPress displays a list of blogger’s favorite blogs in the sidebar of their blog home page. Now Word press BlogRoll does not have the option of adding the rel="nofollow" tags for sites in the Blogroll but has lots of other option for XFN (XHTML Friends Network) and for my blog the case was that I link to lots of my friends blog and nothing related to link exchange or selling links.

    I wanted to add the rel="nofollow" tag but not for all the links because I would also like to have the XFN option open.

    So here is how you should be doing that.

    We need to hack through WordPress core source code file. Go to wp-includes/ directory of your blog root folder, then edit the bookmark-template.php file

    Find
    PHP:
    if ( '' != $rel )
        
    $rel ' rel="' $rel '"';
    Replace with
    PHP:
    if ( '' != $rel )
        
    $rel ' rel="' $rel '"';
    else
        
    $rel ' rel="nofollow"';
    You need to do that at two places. One in _walk_bookmarks function and other in get_links functions.
     
  2. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    736
    Likes Received:
    38
    Trophy Points:
    28
    Good. Should add that on my blog
     
  3. ralent

    ralent New Member

    Joined:
    Dec 5, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Shabbir ... I see the code string in _walk_bookmarks on my bookmark-template.php file but I can not find get_links.

    I am running WordPress 2.3.1. Is it possible that the bookmark-template.php file has been changed with this version of WordPress.
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    That can be told by wordpress guys only but in 2.2.2 its there.
     
  5. rapwaydown

    rapwaydown New Member

    Joined:
    Nov 28, 2007
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    0
    does that work on blogger
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    It should but the code may not be same. Blogger does not provide you the code as far as I know but I may be wrong.
     
  7. William9

    William9 Member

    Joined:
    Feb 9, 2010
    Messages:
    60
    Likes Received:
    3
    Trophy Points:
    8
    Gender:
    Male
    Location:
    India
    Home Page:
    http://www.host.co.in/
    Now isn't this a strange behavior by Google. A website should not contain external links at all :nonod: even with rel="nofollow" tags, whereas these links are useful for people and make things easy for search engine spiders as they are as a simple text for them.
     
  8. etiergjt

    etiergjt New Member

    Joined:
    Mar 21, 2011
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://forums.moneymakingfocus.com
    He is talking about WORDPRESS blogroll?Okay?
     
  9. sandyofmalay

    sandyofmalay New Member

    Joined:
    Aug 6, 2011
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    Searched for a solution to this myself, as far as I'm aware you can add the rel=nofollow tag to each link as you add them also. Suppose it's a weigh up whether you apply this based on how frequently you need to alternate or add links to the sidebar
     
  10. roars1111

    roars1111 New Member

    Joined:
    Sep 5, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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.

    open file /wp-admin/edit-link-form.php
    Go to line line 193 / 194 and find
    <tr>
    <th scope="row"> <?php _e('identity') ?> </th>
    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.
     
  11. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Editing WP Core files never makes sense and your changes would vanish when upgraded or you may not be able to upgrade or else you may need to make those changes after every upgrade.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice