A Short Guide on DoFollow/Nofollow

Yesterday i was reading a post from my buddy Jym, and many people were interested in knowing how to add nofollow to the links.

So, In this post i’m going to talk about how to add nofollow to links, Adding Dofollow in the comment links and Making blogroll links dofollow.

What is Dofollow & NoFollow?

Do Follow links are links that are and that can be crawled by search engines. No-Follow links are, of course links that won’t be crawled by search engines.

How to add Nofollow to any link

By default your link look like this

<a href="http://www.wpkube.com">WP kube</a>

To make it nofollow, simple add nofollow attribute

<a href="http://www.wpkube.com" rel="nofollow">WP kube</a>

Make blogroll links NoFollow

function no_follow( $links ) {
foreach($links as $link) {
$link->link_rel .= ' nofollow';
$link->link_rel = trim($link->link_rel);
}
return $links;
}
add_filter('get_bookmarks', 'no_follow');

Make Comment links Dofollow

function do_follow($string) {
$string = str_ireplace(' rel="nofollow"', '', $string);
return $string;
}
add_filter('comment_text', 'do_follow');

So what are your thoughts of having nofollow or dofollow  links on blogs?  What’s your preference in this topic?  I Would love to hear your thoughts!

Nofollow to any link?

About the Author: Devesh Sharma is a WordPress fanatic and loves experimenting with WordPress themes & plugins. Get more from Devesh on  and Twitter.

You May Also Like:

19 comments… add one
  1. vijay | bayofblog says:

    Indeed info for every bloggers who dont aware about no follow and do follow links, I have a query that How to add no-follow for categories, I need to add no-follow for my categories since it serves multiple keywords…

    • Hi Vijay,

      I guess you the categories menu has been added manually. So you need to look into custom_functions.php file.

      If you need help then just mail me, with your custom_functions.php file.

      Thanks for the comment.

  2. I appreciate the mention Devesh.

    It’s important for every blogger to be able to add the rel=”nofollow” code to appropriate links, and I believe in sharing the link-love with DoFollow comments.

    There’s no point in following links out to affiliate companies, advertisers, Facebook or other social media profiles and this kind of thing. But giving followable status to those who take the time to make genuine comments both encourages participation in your blog and ‘shares the wealth’ so to speak, creating a positive community feeling.

    Useful stuff mate!

    Thanks,

    Jym

  3. Hi Devesh,
    I took me a long time to understand that all links should not be “Do-Follow”. Now I do understand it , it makes life a little less complicated.
    Thanks for taking the time to explain how to add the “No-Follow” attribute.
    I use Thesis personally so adding “Do-Follow” “No-Follow” is a simple painless process.
    Thanks
    Pete

  4. Dino Dogan says:

    I just did this yesterday …now I know I did it correctly lol thnx bro, I really wasnt sure.

  5. Oliver Tausend says:

    HI Dev,

    thanks for sharing this. What do you think about adding “no follow” to social media icons and to the RSS feed, or to any external link apart from comments ?

    How is that done, especially with regard to the RSS feed ?

    Take care

    Oliver

  6. Hello! I’m using thesis theme and i installed the sem-dofollow plugin but my comment links are still nofollow! Can you tell me where should I add the codes which you gave in Thesis?

  7. Victor Canada says:

    Thanks for the concise article and practical code samples. Most of my work is in the Genesis world… Sometimes a little trickier. Just to be clear, it sounds like adding “Dofollow” for link love is more beneficial than simply not specifying either way. I wasn’t clear on that before. Thanks again. Victor

  8. Hi Devesh,
    Thanks for posting this helpful information. However I am still abit confused. I want to make my blogroll links nofollow. You show a code above. What exactly do I do with that code? Where do I put it? Sorry is this is a dumb question.
    Thanks for your help- David

  9. Great article. But, do you know how to make all links in posts / articles dofollow. They are all nofollow and that’s something I don’t want. Kind regards

  10. Hi Mate – thank very much for this informative post. You have really helped me so I will keep coming back to your blog. All the best.

  11. hi
    how to add nofollow to a special blogroll link ?

  12. Sumon @ WP Cypher says:

    Can you please say how can I add no-follow attributes to all the outgoing links from my posts or automatically make it short?

  13. Thank you so much Devesh.. I was thinking doing this since a long time and today I am done with it with the help of your article.. Once again thanks.

Speak Your Mind...

A Weekly WordPress Newsletter...

Subscribe now and you will get -

»  Free Guide – Building a Successful WordPress Blog.
»  Weekly Newsletter curating useful blog posts and resources.
»  Exclusive Discount & Deals on Premium Products.

Your email will never be shared with anyone.