I am developing a static website in AngularJS and I am stuck on an SEO issue. Basically my google webmasters tools tell that there are no crawl errors however when I try to fetch different routes it always returns the same home page result. It doesn't read what is injected in the ng-view div. It just shows the static text in my index.html file. The weird thing is that it actually reads my directive of the landing page '/' because when it renders it reads my navbar, footer, and content, which I have put in an "index-widget" directive but as I said it reads nothing from the ng-view directive. Any help would be appreciated. Here is the page http://luxtest.tk Thanks
Asked
Active
Viewed 917 times
1 Answers
1
Your site is using # urls (eg http://luxtest.tk/#/kontakti) - Google bot will not see these as separate pages. You have two options:
- enable HTML5 mode for your routes.
- implement Google's ajax crawling process.
Switching to HTML5 mode is easier if you can set your hosting up appropriately to point all url's at the index.html page. Switching to HTML5 mode is done in the config for the app:
angular.module('test', [])
.config(function($locationProvider) {
// use the HTML5 History API
$locationProvider.html5Mode(true);
});

Matthew de Nobrega
- 306
- 1
- 10
-
Thank you for your answer. The thing is I have implemented the hash prefix in another test as seen here http://luxuryliving.16mb.com It has the '#!' in front of all routes but I still can't manage to see the pre rendered ng-view. It always shows me the index file as it is. – Ralfs Lagzda May 21 '15 at 14:00
-
Hi @Ralfs, according to [their docs](https://developers.google.com/webmasters/ajax-crawling/docs/learn-more) Google will only index #! urls if you have set up HTML snapshots and configured the appropriate alternate URL's to serve these - this is documented in the link in my answer but setting it up is non-trivial. I never suggested in my answer that just switching to #! urls would make the pages indexable. – Matthew de Nobrega May 21 '15 at 14:19
-
Oh! Sorry about the confusion, it's just that I am kind of new to this and I am finally starting to understand how AngularJS crawling is made possible. Thank you! – Ralfs Lagzda May 21 '15 at 16:43