json-ld.org icon indicating copy to clipboard operation
json-ld.org copied to clipboard

Add guidance on how to host and load contexts.

Open davidlehn opened this issue 12 years ago • 1 comments

The spec should have some guidance on how sites should host contexts and how processors should load contexts.

Contexts are just JSON-LD so could be hosted and retrieved in a number of ways. Guidance might help processors and sites interoperate better. A few hosting possibilities:

  • Regular resource like https://example.com/context that always returns the context as application/ld+json or application/json.
  • Resource that does content negotiation and returns a context only for application/ld+json or application/json requests.
  • Resource that does content negotiation and returns a context for application/ld+json or application/json requests or a HTML embedded context for text/html requests.

I'm assuming most processors will set Accept to at least application/ld+json and application/json but perhaps the spec should explicitly recommend this.

As an example in practice, Google is using a context of http://schema.org/ which will obviously return just HTML for most requests unless content negotiation is setup and used on both processors and the server.

davidlehn avatar Jun 04 '13 23:06 davidlehn

These all seem reasonable. I wonder if we would also need some discussion about retrieving the context from the HTML document in that case. Nevermind the case where an HTML document has two or more script elements of type application/ld+json, one of which is the context.

Maybe the best thing, at least within the specs, is to be silent on JSON-LD within HTML and leave that to a separate note.

gkellogg avatar Jun 05 '13 04:06 gkellogg