Search code examples
javascriptangularjsindexingseogoogle-index

angular.js how to tell google to index my site?


I've an angular.js app. I have followed google's guide for ajax based applications. I've done this:

  1. meta tags

<base href="/"> <meta name="fragment" content="!">

  1. angular.js config

$locationProvider.html5Mode(true); $locationProvider.hashPrefix('!');

  1. my html links looks like this(is it wrong?):

<a ng-href="/#!/login">Login</a>

  1. I submitted sitemap into google search console (x months ago)

I found that I should not use escaped_fragment, is it correct? Am I doing something wrong? It's still not indexing. Google indexed just homepage.

When I run fetch as google tool it renders all pages correctly.


Solution

  • I found that I should not use escaped_fragment, is it correct?

    This is correct, as of this official announcement.


    Also there was additional best-practice introduced:

    For optimal rendering and indexing, our new guideline specifies that you should allow Googlebot access to the JavaScript, CSS, and image files that your pages use. This provides you optimal rendering and indexing for your site. Disallowing crawling of Javascript or CSS files in your site’s robots.txt directly harms how well our algorithms render and index your content and can result in suboptimal rankings.

    Taken from the Official Google Webmasters Blog


    So, are you allowing Googlebot access to all necessary files?

    And how do your URLs look like? Are there also accessible as static HTML? As of the announcements of Google they still recommend the concept of Progressive enhancement, so it might be beneficial in your case to also serve static files.