Oktober 16, 2015

AngularJS SEO – google will index javascript sites

Google moves yet another step forward and indicates that single page application are getting more common. They just announced to drop the support of hashbang urls and crawl javascript sites without any pre-rendering (html snapshots) of the site – which is totally cool. But there are some limits regarding canonical tags as I discovered.

In order to get your single page application indexed it is required to implement the following steps:

  1. use the HTML5 History API
    Which is very easy with ui-router. You’ll find further information in the article about migrating existing projects from hashbang to regular urls. 
  2. use sitemaps
    From our point of view the google bot is able to fetch most sites without sitemaps, but you really should create a sitemap to cover all cases. Especially when you are having views whose urls will never be part of your menu structure or linked on your site. E.g. url with parameter chosen from a select box.  

While the Meta Description and title tags will be perfectly recognized,  google lacks of understanding canonical tags when they are generated from angular. Probably they will adjust this behavior in the near feature. If they wont you are advised to use Schema.org’s breadcrumbs.

Hint: Do not expect markup generated from angular to show up in the „Fetch as Google“. It wont! The result will only show the html file which calls your app. No angular generated html code / content. This does not mean that something went wrong.

If you are still not able to get your site in the google index make sure that you have sitemaps and try use of canonical tags or add your markup with JSON-LD in order to enhance googles understanding of the content.
When all of this wont help – use the comment section and post your link –  we are looking forward to analyze some case studies.

Avatar-Foto

theCodeCampus
Developer at thecodecampus </>

Our knowledge is not simply gained through reading - it is trained, tested and constantly being expanded. Because first and foremost, we are all developers at W11K. The know-how that we acquire here as developers, consultants and information architects flows immediately into our training courses and articles for theCodeCampus.


4 Kommentare zu “AngularJS SEO – google will index javascript sites”

  1. Keith sagt:

    I am having some major trouble getting Google to index my angular site. I’ve tried with and without html5 mode, but I can’t do an extensive sitemap because the HREFs are generated dynamically and more are added daily. The site is newsbrute.com, and I would love any help I can get; I’m desperate at this point.

  2. Michael sagt:

    Hi Can,
    I’m having an issue with Google indexing a part of my site built in AngularJS.

    Recently, we’ve switched domains and went to HTTPS. There was an issue with PhantomJS handling SSL (we’ve always generated the pages server side and delivered that to robots) and crawlers were unable to ‚get‘ these pages. So in effort to resolve all the 5XX errors from crawlers swiftly, we stopped prerendering these pages to bots (since Google supposedly can crawl JS).

    Google isn’t indexing these pages now. All our other pages on the new domain are having no issue getting indexed. Thanks for any help, I really appreciate it!

    https://www.proreferral.com/experts/

  3. Can Kattwinkel sagt:

    Hello Michael,

    sorry for the late response but as far as i can tell your problem is still present. We have multiple sites without HTML-prerenders, no issues so far.

    I’ve looked at your site briefly – i think angular is not handling the routing isn’t it? What else is responsible for Client Side Routing? Make sure it uses the html 5 push state api & provide a sitemap. Usually this is enough. If you want further advice, describe who is responsible for Routing .

    best regards,
    Can

Schreibe einen Kommentar

Add code to your comment in Markdown syntax.
Like this:
`inline example`

```
code block
example
```

Deine E-Mail-Adresse wird nicht veröffentlicht.