Subscribe via

Using jQuery to Easily Dofollow/Nofollow Links

Thaya Kareeson

This might be old news to you, but you should know that the Googlebot now follow links created by Javascript. I have seen evidence of this myself and was starting to get frustrated that I would have to reevaluate my site and patch any leaking link juice from Javascript links. Before I got to the point of full frustration, I realized that I can use this Googlebot “feature” to my advantage and use Javascript itself to easily correct this leaking link juice problem.

Finding Dofollow Links

Before correcting them, we have to find them! I use the awesome SearchStatus Firefox add-on to hunt down any unintentional dofollow links. After installing the plugin, I just enable the “Highlight Nofollow Links” feature by right clicking on the @ symbol on the bottom right of Firefox.
SearchStatus Options
After enabling the “Highlight Nofollow Links” feature, you will see that all nofollow links will be highlighted red.
Nofollow Page

Nofollow Using jQuery Magic

The beautiful thing about jQuery is its ability to perform operations on multiple things with a single line of code. I can abuse this feature to help me set all links in any HTML block with a rel=”nofollow”. Just to give you an idea of how easy and powerful this is, this is the line I use to nofollow all links in my Intense Debate comment form:

$(".comment_form a").attr("rel", "nofollow");

To dofollow a certain set of links, you can do something like the following:

$(".blogroll a").attr("rel", "");

Easy isn’t it? No plugin hacking, no search and replace, and no hassle!

(For those of you who are not the jQuery type, you can take a look at the jQuery selector documentation to figure out the meaning of “.comment_form a”.)

Integration

In this section, I will show you how to get jQuery code to run on every page load.

  • Download nofollow.js and place it anywhere on your server as a base to start from.
  • Modify nofollow.js using jQuery to follow/nofollow any links as you see fit.
  • Refer to nofollow.js in the footer of your template. For example:
    <script type="text/javascript" src="/path/to/your/nofollow.js"></script>

Final Thoughts

After realizing the power of jQuery and this Googlebot feature, patching leaking PR link juice isn’t that bad after all.

Do you guys have a better method of doing this? Do you disagree with my Googlebot findings? Do you know any other search engines that follow Javascript links? Please let me know in the comments section.

Save and Share
StumbleUpon
Reddit

Currently experiencing problems with Intense Debate commenting system. Please make sure your browser's Javascript is enabled and try again later.