Archive for 'SEO'

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.

AJAX and SEO – Is it possible to get them together?

About 7 months ago I threw a question on LinkedIn, AJAX & SEO. It was about is ajax seo friendly! (The website can be found here http://demo.zpbappi.com). Most of the people answered “NO”. All of them suggested me not to use 100% Ajax(ed) website as search endings do not render the javascript. The site has one index.php page and no other pages. When you click any link/buttons it loads the content dynamically using ajax. So I agreed that search engines wont be able to crawl the site properly and stop thinking about it any more.

One week ago I got a project to fully ajaxify a simple static website camillenelson.com with search enginge readability. I already knew (still then) it is not possible. I started re-thinking about the issue and find out a solution of my own. The site has only 8 pages which is a plus point. To assume any site from search spider’s view just disable the javascript from your browser settings and you’ll understand how the spider will go from one link to another.

For example:

<a href="about.html"
onclick="javascript: Load('about'); return false;">
    About
</a>

When javascript is enabled, clicking on About link won’t go to about.html page (return false;), rather it would call Load function. I think you’ve already got the idea!

In real I used jQuery to make the whole thing unobtrusive. The static html pages (already done) except index.html were kept as they are. In index.html the container div (the only div that changes for different pages) loads the content of different pages. I created a folder “ajaxContent” and created the html files with same name of the main html(s) but they contain only the contents, not the full html page.

Here is the jQuery code I used: (N.B. All the links are assigned with “ajax” class.)

$(function() {
    $("a").focus(function() {
        this.blur();
    });
    $("a.ajax").click(function() {
        var lnk = "ajaxContent/" + $(this).attr("href");
        var hover = $(this).find("img").attr("src");
        var img = $(this).find("img");
        $.ajax({
            url: lnk,
            beforeSend: function() {
                $("div#container").html('Loading...');
            },
            success: function(d) {
                $("div#container").html(d);
            },
            complete: function() {
                $("#loading").hide();
            }
        });
        return false;
    });
});

If you have any better idea to make a fully-ajaxed website SEO friendly please let me know.

Thanks

Flickr Uploader Clone: Free Download with source code

I have been searching for flickr uploader clone script online for one of my project. But no luck! There is no such thing on internet. Then I started with analyzing the javascript code of flickr uploader. Lucky that they did not packed their js. Though it was minified by removing white spaces. I used an online javascript code beautifier to make it pretty readable. After that the challenging part began. Cos, the code normally does not work on my local server. After huge hard working of long one week I made it finally. It works great! Even it works for videos too. You can modify the code for uploading any types of file. FYI, Flickr has used YUI (Yahoo User Interface) library for their uploader. So there is no licensing problem if you use this uploader for your own.

For my own need I added 2 extra fields. They are sent to server via POST method along with the FILES. One thing I’ve noticed, it can upload file faster than normal file uploading method. Cos, the file is encoded first via the flash uploader and somehow it is faster than normal.

Upload Multiple File Once

And the great advantage is you can select multiple files during browsing by pressing Ctlr + A or select your files by dragging mouse. By using html <input type=”file” /> you can only select one file at a time which is really so boaring and life-taking when you want to upload hundreds of images.

Flickr YUI Uploader

Here is the online demo. The files are not being saved on my server for my own security!

Download it here completely free in a single zip file!

Modify the index_files/config.js file line no 49,
var _site_root = ‘your script location’;

It won’t work for you until you change _site_root

I have no problem if you use it for your own use. But I do not actually want anyone to put the files/zip on their own site to drive the traffics away from our blog.

If you need any support for modifying or setting it up or any bug report please contact me directly at adnan.eee@gmail.com

Thanks
Have a pain-less uploading experience!