Search code examples
javascriptseogoogle-searchgoogle-rich-snippets

Correct deployment of structured data for Google rich cards


I am confused as to the correct inclusion of structured data, primarily for google rich media.


1. Must/should every page have it's own json, or should the root page contain the json for all pages?


2. The structured data is essentially JavaScript. Does it have to be inline, or can it be in another file?


3. A normal browser might waste time with big structured data JavaScript - information which is irrelevant to it. Is there a good solution/best practice for dealing with this?


Solution

    1. Yes, it should. Structured data is based on the URI paradigm. It means, the unique ID of the document is its URL. So yes, your structured data belongs always to certain URL.
    2. No, it isn't. JSON-LD is not a javascript, even thought it is implemented with the <script> - but it isn't a javascript. And no, it can't be in another file.
    3. Not, it doesn't. Browser don't interpret JSON-LD scripts - they don't need it, this information is not for them and it isn't relevant for the browser's job, which is page rendering. JSON-LD scripts can indeed be placed on the bottom of the HTML source code - but you will not realize any acceleration impact by this.