How to get Google to index a dynamic title in an Angular.js app
Google is indexing my Angular.js app's content just fine, i.e. it executes the JS, XHRs, the whole deal, but for some reason the title is not indexed properly and remains the static HTML fallback (default title set by HTML, before JS is executed).
In index.html I have:
<title ng-bind="title + ' — Default Title'">Default Title</title>
and it's set like this whenever the route changes:
app.run ['$location', '$rootScope', ($location, $rootScope) -> $rootScope.$on '$routeChangeSuccess', (event, current, previous) -> $rootScope.title = current.$$route.title if current.$$route ]
Example of the page: http://registerzdravil.si/zdravila/aspirin-protect-100-mg-gastrorezistentne-tablete
TL;DR: Google indexes my Angular app just fine, but doesn't index dynamic titles for some reason.
I am fairly sure you do not have much control over this. here are some links:
They both explain that:
Basically, Google says: we know better, you can try and write a title we like, but we reserve to do whatever to make people click on your result. There is no way to prevent this from happening right now.