1

my current html looks like this:

<title ng-bind="title">Loading</title>
<meta name="description" content="[[description]]">
<base href="/">
<meta name="fragment" content="!">

angular.js config:

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

I thought it's enough to let the googlebot index site correctly. But nope, it's not taking correct title or description. If I run "fetch as googlebot" site renders correctly..What should I do?

dontHaveName
  • 1,899
  • 5
  • 30
  • 54

3 Answers3

2

I don't think that you need to prerender your pages for the Google crawler anymore. A while back it started taking note of the javascript changes.

I've actually answered a question about AngularJS seo that will help you here:

Look for my answer on the above link. I've also provided a directive that might be useful to you.

By the way, are you sure you are using the angularjs expression properly? You have decription using [[]] normally it is {{}}

Community
  • 1
  • 1
Archernar
  • 463
  • 5
  • 6
  • I will take a look at link, thanks. And yeah, I'm sure I set custom syntax. – dontHaveName Sep 10 '15 at 22:10
  • Vote the answer up if you think it'll help others. I think the current accepted answer is a whole lot more work than what i've mentioned, esp since it is no longer necessary I believe. – Archernar Sep 23 '15 at 05:08
1

You need a prerendering engine to render the HTML for the bot. Read something here: https://scotch.io/tutorials/angularjs-seo-with-prerender-io

And here about the escaped_fragment the bot uses to crawl your site: https://developers.google.com/webmasters/ajax-crawling/docs/specification?hl=en

michelem
  • 14,430
  • 5
  • 50
  • 66
0

Sometimes Google will ignore the information provided in title or meta tags. But it looks more like a technically problem.

I would at least use ng-content-attr instead of writing it directly into the meta content attribute.

ng-attr-content="{{description}}"

Maybe Google extract your title information before anuglar has replaced it with the right string!


Another way is to use a directive that takes care of this for you. luckily i just wrote one.. just go ahead and try, you'll see with this setup google will recognize your title! https://github.com/w11k/w11k-angular-seo-header/blob/master/angular-seo-header.js

Carka
  • 161
  • 5