-
Notifications
You must be signed in to change notification settings - Fork 23
Link header for HTML and JSON-LD #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Let me rephrase. What you are suggesting is to link a JSON-LD context from an HTML page rather than embedding it. This would be done using RFC5988 HTTP headers, so
Am I getting this correctly? |
If I understand this, this approach sounds like it wouldn't be that functionally different from following a redirect. So, a JSON-LD processor would hit a URL, get back something that isn't cc: @msporny -- thoughts? |
The thought I expressed on the call was to re-use the Link header but add semantics so that if the response when fetching a context is not |
Let's be sure to distinguish between the HTTP header conversation and the HTML-level Also @gkellogg's concerns about infinite recursion would likely apply to both scenarios. |
Minutes of previous call: https://www.w3.org/2018/json-ld-wg/Meetings/Minutes/2019/2019-07-19-json-ld#section5-1 |
This issue was discussed in a meeting.
View the transcriptLink header for HTML and JSON-LDBenjamin Young: See Issue 204 Gregg Kellogg: this was trying to rely to danbri’s concern about relying on content negotiation … the best solution I came up with was to rely on a link HTTP header … A JSON-LD processor expecting a context at a given URL would check for this header, … and follow the link if any. Ivan Herman: other people do that, with rel="manifest" … the Web Publication WG does something similar with rel="publication" … we can bikeshed about what rel value we want. But this makes sense. Ruben Taelman: link headers are not always possible on static websites, e.g. github pages. Benjamin Young: just to be clear, the link header we are talking about is a HTTP header, not HTML … It is not as common as content negotiation on static sites. … So we should specify that JSON-LD processors should first try content-negotiation, … if it fails, it should try HTML (which implies embedding a HTML parser) Dave Longley: +1 to link headers, -1 to involving HTML processing at all w/context processing as it breaks the ecosystem Benjamin Young: then it should check the link header. Pierre-Antoine Champin: I think this solution makes sense … whether content negotiation has priority or not, I think this would be nice to have … the way I saw it this was a way to get rid of a dependency on HTTP Gregg Kellogg: this is all because the desire of schema.org (and may be others) … to avoid doing content negotiation. … Whenever we can’t do conneg nor HTTP headers, … we are back to parsing HTML. Dave Longley: I would be in favor of the link HTTP header solution, … even if it does not solve all problems. … I am against the reliance on HTML parser. This would break the ecosystem. … Also, we should not make decision on the features that github pages have today. … That may change in the future. Benjamin Young: (a cosmetic argument that I missed) Ruben Taelman: I don’t see the benefit of the link header over conneg; … if a host supports one, it should supports the other, right? Dave Longley: some static sites can do link headers. … It requires less processing on the server side than conneg. Pierre-Antoine Champin: +1 |
ProposalIn LoadDocumentCallback (which defines how all JSON-LD processors should handle document retrieval) after step 4:
So, in the case that an HTML resource is returned with a link header such as the following: Link: <https://schema.org/docs/jsonldcontext.jsonld>; rel="alternate"; type="application/ld+json" the document loader would see that the We'd also need a section in the syntax document near Interpreting JSON as JSON-LD to describe this behavior and note it's utility for static websites. This would also allow us to remove the need to process embedded HTML for context files, as this handles the documentation requirement. We could consider a different link relation, but "alternate" seems appropriate, when coupled with type. cc/ @danbri |
Minor:
one 'and' too much... Otherwise +1 for me |
…ld+json` to be used as a redirect if the retrieved document is not JSON. For w3c/json-ld-syntax#204.
…and add an Alternate Document Location section. For #204.
Reverses #66. This can be done because of w3c/json-ld-syntax#204.
This reverts w3c/json-ld-api#66, which we can do because of #204.
This reverts w3c/json-ld-api#66, which we can do because of #204.
This issue was discussed in a meeting.
View the transcriptBenjamin Young: Link header: preemptive conneg.Benjamin Young: See Syntax issue #204 Benjamin Young: See API PR #134 Benjamin Young: See Syntax PR #212 Benjamin Young: 2 PRs are ready to go, right? Gregg Kellogg: Yes. Open question for base during redirect. … If you retrieve something non-json. Doc loader will detect rel-alternative links, and redirect to that resource. … I think the original requested document should be preserved as base URL. … Just like 303 redirect semantics. In 302, this would not be the case. Rob Sanderson: JS will silently follow redirects and give you the results. So you don’t know which redirects got you there. Gregg Kellogg: JS should correctly implement redirect semantics. Dave Longley: +1 to using 303 semantics, so on, +1 to gregg’s position. Gregg Kellogg: You have processing state to keep track on this. Proposed resolution: merge api#134 and syntax#212, and close syntax#204 (Ivan Herman) Rob Sanderson: +1 Dave Longley: +1 Benjamin Young: +1 Rob Sanderson: ![]() Ivan Herman: +1 Gregg Kellogg: +1 Ruben Taelman: +0.5 Resolution #2: merge api#134 and syntax#212, and close syntax#204 |
…and add an Alternate Document Location section. For #204.
…ld+json` to be used as a redirect if the retrieved document is not JSON. For w3c/json-ld-syntax#204.
Reverses #66. This can be done because of w3c/json-ld-syntax#204.
This reverts w3c/json-ld-api#66, which we can do because of #204.
If we remove support for context extraction from HTML, we might want to consider broadening the Link Header to be able to specify the context location, which might help @danbri. We also might want to revisit whether it can bu used for JSON-LD files as wee, as it’s currently restricted to just plain JSON.
The text was updated successfully, but these errors were encountered: