Mobile app version of vmapp.org
Login or Join
Fox8124981

: SEO AJAX Calls for Google 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

@Fox8124981

Posted in: #Ajax #Google #Jquery #Seo #Wordpress

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:

$.ajax({
url: "/thenewsite/wp-content/plugins/mass/return_body.php",
type: "post",
dataType: "json",
data:
{
'key_page' : key_page,
'function' : 'page_grab'
},
.....
});


return_body.php:

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

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

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

$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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Fox8124981

1 Comments

Sorted by latest first Latest Oldest Best

 

@Angie530

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme