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?
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:
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.