I have a working WordPress site that contains a custom navigation and retrieves a page based on title. So what it looks like is, lets say I have a page called test and the user selects test on the custom navigation. The href link that is placed would be #!test. Now I am fully using Ajax to call the content for test and that looks like:

        url: "/thenewsite/wp-content/plugins/mass/return_body.php",
        type: "post",
        dataType: "json",
            'key_page' : key_page,
            'function' : 'page_grab'


$base = 'http://www.massmedicalstorage.com/thenewsite';

if ($fragment = $_GET['_escaped_fragment_']) {

    $page = get_page_by_title($fragment);
    print_r ($page);

$DBH = createConnection();
$response = array("status" => "ok", "code" => 1, "original_request" => $_POST); // CREATE REQUEST

if($_POST['function'] == 'page_grab')
    $page = get_page_by_title($_POST['key_page']);
    $response['data_retrieved'] = $page;

    if($page !== null)
        $response['status'] = "found";


Now the Ajax function than places the content retrieved based on design requested.

So the area that is gray for me is, am I working with Google correctly for SEO ajax purposes? Am I returning my content correctly in the _escaped_fragment_ section? Also how do I check to see if google is fetching the ajax content? If I am not properly retrieving a snapshot of my html how do I do so correctly?


You need to have the proper meta tag for google to know that you are crawling Ajax based pages. In essence when google sees your escaped fragment they replace it with a querystring and pull that page instead. This makes your Ajax page crawlable. An alternate approach is just to use HTML history api and update the url when you make an ajax call. This way you dont have too goof around with HashBang / Google & Bing ajax crawling spec. It 100% works, but html history is the new and better way of doing this, and gets you much cleaner URLS. Also gives you a great fallback for users who dont have javascript in place because the actual page will load normally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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