7

For instance, if the content loads dynamically and has hashed URLs like "mysite.com/#/some/page" is that SEO friendly or will it not be indexed by Google and Bing?

Charles
  • 48,924
  • 13
  • 96
  • 136
Geoff
  • 9,096
  • 12
  • 46
  • 66
  • I also had a similar question here http://stackoverflow.com/questions/19287476/why-search-engines-dont-run-javascript. It seems like google bot already runs javascript http://www.forbes.com/sites/velocity/2010/06/25/google-isnt-just-reading-your-links-its-now-running-your-code/ – Khanh TO Oct 19 '13 at 03:12

2 Answers2

2

Since search engines do not run javascript, you need to make static html versions for your pages so they can be indexed by them, also you should have a sitemap. There is a library that helps acomplish this using phantomjs: https://github.com/steeve/angular-seo This is further explained here: http://www.yearofmoo.com/2012/11/angularjs-and-seo.html

There are some paid services that take care of this for you.

Also Google has some more information on the matter: https://developers.google.com/webmasters/ajax-crawling/

  • 1
    This is not true, google and bing both crawl javascript content – Michael Tempest Jul 21 '14 at 13:42
  • Google just started doing this a few months ago: http://googlewebmastercentral.blogspot.mx/2014/05/understanding-web-pages-better.html I don't know about angular support though. – Marco Rivadeneyra Jul 21 '14 at 17:15
  • 2
    It has been able to crawl a lot of JavaScript content for longer than this, but they have never delved into the true extent of what it can index. Back in 2012 I worked for google on a project using javascript content and they said that there was no problem with it indexing the content. Back then it was written mostly with the google closure library. – Michael Tempest Jul 24 '14 at 15:14
  • For bing to do the same, generally you have to indicate javascript content using /#!/ in your link structure – Michael Tempest Jul 24 '14 at 15:14
2

Even if you have statically generated versions of your pages, Google doesn't follow the ui-sref directives that ui-router provides. Your best option is to use ng-href in combination with the escaped fragment ajax crawling specification. The project I'm currently working on is based on MeanJS which has a SEO module that implements the escaped fragment and is definitely working with Google.

MeanJS does include ui-router, but I only use it from the controllers, not in the views.

snez
  • 2,154
  • 21
  • 18
  • Is this advice still accurate. Should ui-sref be avoided when SEO is a factor? – larpo May 02 '15 at 19:39
  • @larpo not much has changed since the answer, but to be prudent you can test your site by searching for specific ui-sref pages in google... – snez May 06 '15 at 16:08