SEO tips: Reduce your unwanted external links using jQuery
In SEO one of the most important factor is reducing the external links. A common practice is using rel=”nofollow” or rel=”external nofollow” or rel=”nofollow me” with <a> tag to reduce the page rank leakage. But do you know there may be some external links on your blog which you are not aware of at all! In most cases WordPress blogs have links to wordpress.org and the theme provider’s site at bottom which does not have the “nofollow” attribute. The indexing and ranking procedure of search engine is still a mystery and there are rumors that some spiders follow the nofolllow links! So adding a nofollow is not always the good solution. Some WP plugins and widget codes insert direct link to their sites.
It may sound odd.. the most popular social bookmarking widget AddThis button code has direct link to their site and we never bother to look inside their code. Here is the AddThis button code:
<!-- AddThis Button BEGIN --> <div> <script type="text/javascript"> var addthis_pub="4a11abc75f3cd444"; </script> <a href="http://www.addthis.com/bookmark.php?v=20" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"> <img src="http://s7.addthis.com/static/btn/sm-plus.gif" width="16" height="16" alt="Bookmark and Share" style="border:0"/> </a> <script type="text/javascript" src="http://s7.addthis.com/js/200/addthis_widget.js"></script> </div><!-- AddThis Button END -->
You see there is a direct link to http://www.addthis.com/bookmark.php?v=20. If you remove this the code won’t work and adding nofollow is not a good solution. I modified their code in my own way and removed the link.
To do this first I saved the js (http://s7.addthis.com/js/200/addthis_widget.js) that is loaded at first from the addthis server. According to their TOS there is no problem if I cache their js code and use an image of my own choice. So I used a different addthis image with shadow which you can see at top-left side of this post and added a pseudo class “bkmrk” to it.
This is the php code for the template:
<img class="bkmrk" src="<?php bloginfo('template_url'); ?/>/images/addthis.gif" alt="bookmark" title="< ?php the_title(); ?>" name="< ?php the_permalink(); ?>" border="0" />
The title of the img tag is title of the post and the value of the name attribute is permalink.
Then I included the js and jQuery library and used this simple code on domready:
jQuery(function(){
jQuery("img.bkmrk").each(function(){
var url = jQuery(this).attr("name");
var title = jQuery(this).attr("title");
jQuery(this).wrap('<a onclick="return addthis_sendto()" onmouseout="addthis_close()" onmouseover="return addthis_open(this, \'\', \'' + url + '\', \'' + title + '\')" href="http://abcoder.com/"></a>');
});
jQuery("span#wp").replaceWith('<a rel="external nofollow" href="http://wordpress.org" title="WordPress" target="_blank">WordPress</a>');
jQuery("span#theme").replaceWith('<a rel="external nofollow" href="http://web2themes.com" title="WordPress Themes" target="_blank">Web 2.0 Themes</a>');
});
This code simply adds the same functionality but the big difference is search bots won’t find the links as this is done using javascript. So if you see the html source code you won’t see any direct link to addthis.com. The last 2 lines of the code is for links to wordpress.org and web2themes.com.
Isn’t it smart?
However I’m not 100% sure if adapting this method is legal or not! So use this at your own risk. On some blogs I’ve noticed this method being used for links to the commentators website. But right now I’m not sure which wordpress plugin they use for this purpose.
Related posts:
- jQuery “live” event
- jQuery cycle plugin as carousel
- AJAX and SEO – Is it possible to get them together?
5 Comments to “SEO tips: Reduce your unwanted external links using jQuery”
Leave a Reply



My Elance Profile
[...] See the rest here: SEO tips: Reduce your unwanted external links using jQuery [...]
Hey man, my name is Justin Thorp. I’m the Community Manager for AddThis. I understand that having a bunch of unwanted links on your site and having Google classify you as a link farm is bad but how does one link to AddThis hurt your SEO? I’m not sure that I understand.
@Justin, I’m not telling people to “adopt” this massively. This is just an idea/example. Someone can use it for other purpose.
thanks for the initiative : however the tutorial is not well detailed for people not so familiar with javascript librairies like jquery and domready : where to put the code …etc : you can have a downloadable version of the files before and after modification. Thanks very much for the sharing
Thanks for the tip.
What about addthis code caching which they provide?
It also connects to their server, for no reason.