3

Google has no problem fetching and rendering the dynamically loaded content of all of my Angular SPA pages. So that's good. But will the crawler recognize Microdata and/or RDFa markup in my templates? I want to create some rich snippets for my product pages by following Google's documentation.

Angular currently doesn't have the ability to create dynamic scripts (see this issue), so I was going to try implementing Microdata and/or RDFa markup instead.

Will this work? Do I have to have server-side rendering in-place for google to recognize the rich product snippets? Or is Google smart enough without server-side rendering?

Maarten
  • 4,503
  • 7
  • 35
  • 48
Kevin LeStarge
  • 6,087
  • 3
  • 15
  • 29
  • Once I’ve created an application that was able to be rendered both server-side (HTML) and client-side (by parsing server’s JSON). Initial (first) request was always rendered server side, then the client downloaded the JavaScript part which handled further rendering. If I remember correctly, Googlebot wasn’t recognizing this application’s Microdata from pages other than the home page until I implemented “rendering” Microdata in that JavaScript part. – gsc Mar 30 '17 at 20:08
  • 1
    [Does Schema.org markup work if markup is dynamically built with JavaScript?](http://stackoverflow.com/q/29064209/1591669) – unor Mar 31 '17 at 00:00

1 Answers1

1

Microdata and RDFa in ng2 sounds like it would be much more difficult to implement than JSON-LD. Taking this path means that you are disseminating the SEO concern throughout all of your components views which is going to result in more complexity and lower your extensibility as far as SEO.

Google recommend JSON-LD over Microdata and RDFa as well, which means that in the long run, its likely the better choice as they'll most likely be focusing on building further SEO optimisations towards JSON-LD.

I haven't been working in ng2 for a while now, but this answer on the original question which relates to the github issue you've linked to suggests that inert script tags are no longer stripped?

I'd test to ensure that inert tags are still striped or whether it has been fixed in the framework before making the choice to move to MD or RDFa tags.

As to answering your original question as to whether google would index MD without SSR, I can't say from experience, but I'd say that there is a high probability of it working as they are rendering the JS version of the site so it would make sense for them to read it.

Community
  • 1
  • 1
Ian Belcher
  • 4,649
  • 2
  • 29
  • 39
  • I totally agree with you on your concerns for lower extensibility and added complexity with the MD or RDFa solution. However, [the link](http://stackoverflow.com/questions/38088996/adding-script-tags-in-angular2-component-template/38090157#38090157) you posted shows only a client-side solution for the JSON-LD solution. I'm going to be implementing Angular-Universal soon for server-side rendering, which won't work with that solution. – Kevin LeStarge Mar 31 '17 at 17:21
  • Using universal shouldn't have an affect on JSON-LD unless I'm missing something? Universal will just mean that the JSON-LD tags (if they can be rendered by ng2) will be rendered server side and will be sent in the initial html payload? – Ian Belcher Apr 02 '17 at 22:52