Thursday, August 12, 2010

AJAX in your site, should this be a concern for your SEO efforts?

We can see in many current website architecture design that webmasters have discovered the advantages of using AJAX to improve the user experience on their sites, creating dynamic pages that act as powerful web applications. However, just like Flash was a stumbling block for SEO opportunities, AJAX can make a site difficult for search engines to index if the technology is not implemented carefully. There are two main search engine issues around AJAX: Making sure that search engine spiders can see your content, and making sure they can see and follow your navigation.

While Googlebot is great at understanding the structure of HTML links, it can have difficulty finding its way around websites which use JavaScript for navigation. Google continues to work on doing a better job of understanding JavaScript, but your best bet for creating a site that's crawlable by Google and other search engines is to provide HTML links to your content.

If using AJAX to create your links, format them so they'll offer a static link as well as calling a JavaScript function. That way you'll have the AJAX functionality for JavaScript users, while non-JavaScript users can ignore the script and follow the link. For example:

<a href="ajax.htm?foobar=32" onClick="navigate('ajax.html#foobar=32');
return false">foobar 32</a>

Note that the static link's URL has a parameter (?foobar=32) instead of a fragment (#foobar=32), which is used by the AJAX code. This is important, as search engines understand URL parameters but often ignore fragments. Since you now offer static links, users and search engines can link to the exact content they want to share or reference.

While Google is constantly improving their crawling capability, using HTML links remains a strong way to help (as well as other search engines, mobile devices and users) better understand your site's structure. If you need to balance out the benefits of dynamic delivery using AJAX, what does your static sitemap page provide as an alternative to ensure a visibility to all pages in your site?