2

What's the best practice for exposing ajax delivered content within WordPress to ensure that it's indexable by Google, etc.?

I've got a site where I am using the jQuery tabs control to display content of child pages dynamically on the parent page via ajax. Changing tabs switches between child pages and the url in the browser updates to /parent-slug/#child-slug without page refreshes. So there is no direct path to /parent-page/child-page linked in the site.

I have the functionality working as described. But Google is not going to be able to access the JavaScript loaded content. I couldn't seem to find a plugin that exposed posts using Google's hash bang fragments.

What should I do to make sure this content gets indexed?

1 Answer 1

5

Any reasons you couldn't put an anchor link to the actual page in your tab control? Then use jQuery to make sure it returns false and doesn't "work" for normal visitors.

In fact, that's what the jQuery Tabs control page suggests:

Tabs supports loading tab content via Ajax in an unobtrusive manner. The HTML you need is slightly different from the one that is used for static tabs: A list of links pointing to existing resources (from where the content gets loaded) and no additional containers at all (unobtrusive!). The containers' markup is going to be created on the fly:

<div id="example">
     <ul>
         <li><a href="ahah_1.html"><span>Content 1</span></a></li>
         <li><a href="ahah_2.html"><span>Content 2</span></a></li>
         <li><a href="ahah_3.html"><span>Content 3</span></a></li>
     </ul>
</div>

Obviously this degrades gracefully - the links, e.g. the content, will still be accessible with JavaScript disabled.

If there are links there, a bot will follow them. You should also be using a sitemap, which will help a bot find all pages on your site.

1
  • The links do show up as a plain list with JavaScript disabled, so it ends up working without any additional work. Commented Aug 18, 2011 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.