John John - 2 years ago 57
Javascript Question

Googlebot doesn't see jquery generated content

I use jQuery to retrieve content from the database with a json request. It then replaces a wildcard in the HTML (like %title%) with the actual content. This works great and this way I can maintain my multi-language texts in a database, but Googlebot only sees the wildcards, not the actual content. I know Googlebot sees pages without javascript, but is there a way to deal with this? Thanks!

Answer Source

You should give this document at Google a thorough read.

It discusses how to enable Googlebot to index:

  • pages where content changes depending on changing #hashfragment values in the URL.
  • pages where content changes immediately upon load but lack any special #hashfragment per se.

In short, you're looking at adding the <meta name="fragment" content="!"> as discussed in "step 3", and responding to special requests on the server-side by delivering back all the content all at once, that your client code otherwise would have generated after page load. These special requests are actually requests with ?_escaped_fragment_=... in the URL, indicating to the server that it should pre-bake (my words) all of the final presentation into a single response for the Googlebot.

That said, since you'd be going through the effort of outputting filled in content for this special case, you may be better off doing that in your general case (avoiding the need to deal with Google's _escaped_fragment_ requests), with perhaps still a way to swap out your markers after page load if necessary (e.g. through the use of spans with a certain class or id for identifying them).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download