home | non-tech | cs | ee | about
Abstract New

Search engines, SEO and AngularJS - Googlebot finally understands Javascript

AngularJS, crawlers and SEO - the past

Search engine crawlers typically crawl static webpages. In the case of a site that leverages Javascript to render content, the crawlers retrieve the Http response which contains Javascript that would not be executed. Since the script is not executed the crawlers do not have access to the actual content on the page. So AngularJS (and similar Javascript frameworks) have always been considered bad for SEO. Consider an AngularJS single page application where the contents are dynamically loaded - the crawler will not have access to any of the content since it does not execute the Javascript.

There are/were ways to nudge/redirect the crawler to use routes specifically configured for it and serve a version of the static content from the server. This workaround caused many to shun these frameworks for creating content rich sites and their usage was restricted to interactive web applications.

What changed?

Google recently announced that their crawlers would "understand pages by executing JavaScript".

The test

A quick test using Webmaster tools revealed that google was fetching and rendering pages created using AngularJS after executing the Javscript.

In order to definitively prove that Googlebot (a.k.a the web crawler, spider etc) does interpret angular expressions I did the following test:

Created and uploaded a page with a simple angular expression for google to index. The angular expression summed up the numbers 44545 and 88495.

Angular example script


var abcModule = angular.module('abcModule', ['ngRoute']);

abcModule.config(
    function ($routeProvider, $locationProvider) {
        $routeProvider.when('/',
            {
              
            });
    $locationProvider.html5Mode(true);
    });

HTML to render


// include within ng-app="abcModule"
This is a test to see if {{44545 + 88495}} is being rendered correctly

Results

Submitted this page to google to index a couple of weeks ago. Now, if you do a search for the phrase on the page (replacing the Angular expression with 133040) you will see that the page pops up in search results.

1 comment:

Post a Comment

© 2014 - 2015 abstract new. All rights reserved.