W3C home > Mailing lists > Public > public-schemaorg@w3.org > August 2022

Re: Permit external JSON-LD files?

From: Dave Vieglais <dave.vieglais@gmail.com>
Date: Mon, 29 Aug 2022 12:41:31 -0400
To: public-schemaorg@w3.org
Message-ID: <A76BE8DA-8730-4337-8C7A-AABFB39130C3@gmail.com>
I believe another approach is to use a link header in the HTTP response 
of the requested resource. This is laid out in the current JSON-LD spec 
[§ 9.4 Remote Document and Context 
Retrieval](https://www.w3.org/TR/json-ld11-api/#remote-document-and-context-retrieval). 
Basically if the response to a request `https://example.org/foo.html` 
includes a `Link` header such as:

```
Link: <https://example.org/meta/foo.jsonld> 
;rel=“alternate”;type=“application/ld+json”
```

then the JSON-LD processor should recognize the alternate location for 
the requested document type and retrieve the JSON-LD document from 
`https://example.org/meta/foo.jsonld`.

One benefit of such an approach is that a client interested in JSON-LD 
can issue a HEAD request to determine the location of the JSON-LD before 
retrieving the resource, saving a bit of traffic.

I can’t speak for how broadly this approach is supported however.

regards,
   Dave Vieglais


On 29 Aug 2022, at 11:29, Hans Polak wrote:

> Good afternoon,
>
>
> This is from StackOverflow. 
> https://stackoverflow.com/questions/30864619/does-json-ld-have-to-be-embedded
>
>
> <link href="/myid123/jsonld.js" rel="alternate" 
> type="application/ld+json" />
>
>
> Yours sincerely,
> Hans Polak
>
> On 27/8/22 19:17, Roger Rogerson wrote:
>> I appreciate that things like MicroData are inlined,
>> and utilise the HTML Markup to associate data with content.
>>
>> But JSON-LD Schema is embedded.
>> In many cases, this additional code serves no "human" purpose,
>> and is provided for "machines" (typically Google).
>>
>> A shining example is the following web page (remove spaces after 
>> periods):
>> https://www. delish. com/cooking/g1956/best-cookies/
>>
>> That page has approximately 35Kb of Schema.
>> That is loaded for every single human visitor.
>>
>> In the case of popular pages - this means a large amount of 
>> unnecessary
>> code is transferred (Gigabytes or higher per year).
>>
>> If the JSON-LD could be externalised into a referred to file,
>> then this could reduce bandwidth consumption for users,
>> help speed up some page load times/improve performance
>> and help towards "going green".
>>
>>
>> I appreciate that technically,
>> this isn't about "Schema" directly,
>> but about how Browsers and Parsers can recognise and handle
>> and externalised version - but I'm hoping this is the right place
>> to get it considered and the right people to see it/push it to 
>> browser vendors.
>>
>>
>> Thank you.
>> Autocrat.
Received on Monday, 29 August 2022 16:41:47 UTC

This archive was generated by hypermail 2.4.0 : Monday, 29 August 2022 16:41:48 UTC