homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Need a SEO workaround for a AJAX product matrix
products are not getting spidered

5+ Year Member

Msg#: 4168806 posted 10:25 pm on Jul 12, 2010 (gmt 0)


I have a site that calls or paginates with an AJAX call so there's no way that the spiders are getting into the product level with a normal crawl. Is there an onpage workaround that I can use to increase the spiderability? I know I can use an XML site map but I'm looking for other ideas.




WebmasterWorld Senior Member 5+ Year Member

Msg#: 4168806 posted 12:16 pm on Jul 13, 2010 (gmt 0)

By far the best solution is to rework the design so that it works with javascript disabled and use ajax only used to enhance it.

A partial workaround is to put links to ajax content within noscript tags, but this indexes the bare ajax pages, so if these are visited you need some script to get the ajax back into its intended context.


Msg#: 4168806 posted 12:59 pm on Jul 13, 2010 (gmt 0)

Rule 1 in javascript: Use javascript that degrades gracefully.

How many times I have visited a site that forced me to turn on javascript for the smallest things....

Normally I would use a href tags to link through the 'normal' pagination, and have them replaced (by js) with buttons that will paginate through ajax calls.


WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4168806 posted 6:31 pm on Jul 13, 2010 (gmt 0)

What do your links look like? If you've implemented the Ajax correctly, you should have something like this.

<a href="some_script.php?page=2" onclick="return some_function(this.href);">product one</a>

Return false from "some_function" and if JS is disabled, it will follow the href. If you have

<a href="#" onclick="some_function('products','2');">product one</a>


<a href="javascript:some_function('products','2');">product one</a>


<a href="javascript:void()" onclick="some_function('products','2');">product one</a>

You have a problem. At any rate, you may just need to change the links and add return false from your functions.


WebmasterWorld Senior Member 5+ Year Member

Msg#: 4168806 posted 11:20 am on Jul 18, 2010 (gmt 0)

IMO, if the ajax is implemented correctly the links will look like:

<a href="some_script.php?page=2" class="some_class">product one</a>

No js handlers mixed with HTML. The only hook will be onready and even that I would prefer to see it as separate function call at the end of the HTML code so you don't bloat the page with js code the actual content.

The framework should have a modular structure so if js is off the server generates the full page on a link click. Otherwise the ajax retrieves from the server just the HTML to update in the page.

This is totally transparent to spiders.


5+ Year Member

Msg#: 4168806 posted 2:36 pm on Sep 16, 2010 (gmt 0)

You all rock!


WebmasterWorld Administrator httpwebwitch us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4168806 posted 12:56 pm on Sep 17, 2010 (gmt 0)

supplemental note:

always build your entire site with JavaScript turned off, so it is 100% navigable without executing script. Then - when everything is finished - add the AJAX features. These extra behaviours should be added using only external JS files, hooking onready (or onDomReady) -- like enigma1 said.

It's called progressive enhancement, and it ensures that your site is accessible & crawlable and indexable.


Msg#: 4168806 posted 4:59 am on Sep 18, 2010 (gmt 0)

Google have proposed and implemented a solution to help them index AJAX based websites. I've experimented with it here: < sorry, no self-promotion >

It enables you to tell Google about page fragments (e.g. your dynamic products) and Google can directly send people to those fragments via a URL it indexes.

[edited by: tedster at 9:33 pm (utc) on Sep 20, 2010]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved