Wordpress + angularJS route + SEO Wordpress + angularJS route + SEO wordpress wordpress

Wordpress + angularJS route + SEO


Wordpress already provides you with wp_ajax_ hook for AJAX requests. ( link)

Example:

mysite.com/my-test-page

Wordpress

In this simple case we need our wp_ajax_ hook to retrieve a page by it's slug.

One easy way is to use get_page_by_path($page_path, $output, $post_type), to get the page we want where $page_path is the slug.

Then return the page data as JSON, return json_encode($pageArray);


AngularJS

Route: Do a simple GET:

.when('/:page_slug', {    templateUrl: 'views/page.html',    controller: 'PageController',    resolve: {      page : function($route) {        return $http.get(wp_ajax_url,                           {                          'action': 'the_ajax_hook',                           'data': $route.current.params.page_slug                          }                        );     }    }  })

SEO

Google recently announced they are updating the Webmaster Tools to show you how a Javascript generated site renders and provide you with tips on how to make your site crawl-able.

http://googlewebmastercentral.blogspot.com/2014/05/understanding-web-pages-better.html

Apart from that you can use other services to make your site SEO-friendly today: