SEO Friendly AJAX

AJAX

AJAX isn’t typically thought of as being very search engine friendly. This is because search engines don’t process any JavaScript, which AJAX is built upon.

I’m using a ton of AJAX on this one search engine site. In fact, the search engine itself is done in AJAX since it makes for quick page loads and overall a great user experience. This is a big problem because we also, of course, want all the pages that our search engine indexes to be spidered by Google and the other search engines. Besides the AJAX search, the only other way users reach the bottom level pages is through an advanced search form, which of course Google can’t spider.The solution is to make a hard link search engine that parallels the AJAX one. Since the search begins with selecting a state, I put a list of hard links to each of the states right underneath the map on the main page. The page that these links leads to uses a PHP include to swipe the PHP page that the AJAX search routed to. This page used $_GET variables normally with the AJAX so it was easy to interface with it in this respect. The only thing I had to do was put a switch to take out any of the AJAX JavaScript links from the returned page, and replace it with new hard links.

But there was still one SEO problem to note. Since search engines stop caching pages with more than two $_GET variables, it was important to make the paginator only rely on the state and the page number. All the other links to sort the results were nofollowed. Also the paginator included hard links to each results page and the next/previous links were nofollowed. The idea behind this is to reduce the number of steps from the homepage each link was.All in all it was a rousing success. Googlebot went nuts when it saw the 3,000 some odd user’s pages. It indexed half of them the day after I launched the new hard-link search engine. Sure the AJAX still isn’t SEO friendly, but this is a pretty good workaround, that is also pretty robust, since it uses the same page as the AJAX calls, there won’t be any double-revisioning.



Jon Raasch

Jon Raasch is a UX nerd and free-lance web designer / developer who loves jQuery, Javascript & CSS.




You Might Also Like:


3 Comments to “SEO Friendly AJAX” RSS 2.0

  1. SLR722 says:

    “Since search engines stop caching pages with more than two $_GET variables”

    I have never heard that before. You will find most search engines pick up URLS like file.php?type=image&picture=34

    In fact, you can look at Google, they use a GET request within their own engineering architecture:

    “search?q=test”

    SLR722

  2. Jon Raasch says:

    Hi SLR722,

    That advice on query strings might be a bit antiquated these days, but I remember Matt Cutts writing about using two or fewer query strings for an SEO boost on his blog.

    Although that was a few years ago, I would say that the same advice still holds true, if only for a better user experience.

    But don’t get me wrong, google will track a very popular page with any number of query string variables. However this may still be a detriment to this page’s ranking. Better to stay on the safe side and go with rewrites

    Finally to address your specific points—1: the example URL file.php?type=image&picture=34 has 2 query variables and would be completely trackable. 2: google’s internal architecture has nothing to do with their search algorithm.

    Best,
    Jon

  3. SLR722 says:

    Hi Jon

    First, would be great to have a subscribe to comments button here, I came back to this page via searching for SEO ready ajax plugins.. and then saw an alias of mine and realised it was my own post.

    “That advice on query strings might be a bit antiquated these days, but I remember Matt Cutts writing about using two or fewer query strings for an SEO boost on his blog.”

    Matt Cutts is misleading in his advice. Matt Cutts does not mean SEO. And there are sites that use Flash and Ajax references these days http://url.com/#site?query=test&page=#results and even more crazy URLs like session IDs that get indexed.

    I appreciate you saying that Ajax is not good for SEO in some ways, the fact is that these days its built on Facebook, BBC and Gooogle, its standard technology now and also the fact that you can hard code links like you said:

    site.com/#q=test
    redirects the user to
    site.com/ and loads test via ajax via htaccess

    This would be a better solution

    Best,
    SLR722


Leave a Reply



  • HTML permitted
  • Wrap code in <pre><code></code></pre>
  • Escape HTML to display as text