Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
    
The links do show up as a plain list with JavaScript disabled, so it ends up working without any additional work. –  Dave Konopka Aug 18 '11 at 10:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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