Skip to content
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

playground doesnt import structured data islands #753

Open
melvincarvalho opened this issue Mar 31, 2021 · 3 comments
Open

playground doesnt import structured data islands #753

melvincarvalho opened this issue Mar 31, 2021 · 3 comments

Comments

@melvincarvalho
Copy link

An increasing deployment pattern for JSON-LD is in the form of a structured data island (ie JSON in a script tag)

However, when entering a web page into the playground it handles JSON and not HTML

I believe structured data islands are a valid deployment pattern in the JSON-LD 1.1 spec, so it would be nice if this could work with the many millions of sites out there that use this

Also, IMHO, this neatly completes a circle of creating a semantic web of both human and readable data, without requiring extra moving parts (AJAX, conneg, discovery)

@gkellogg
Copy link
Member

They are defined in the spec, and there is code to support them in the underlying jsonld.js, but I think it’s been held up from being deployed due to some library issues. @davidlehn?

As a fallback, try using rdf.greggkellogg.net/distiller.

@klacol
Copy link

klacol commented May 20, 2021

On the first read, I did not understand what a structures data island is. I came up to this issue, because the playground showed this error when parsing my sample page:

JSON markup - SyntaxError: Unexpected token < in JSON at position 1

I seems for me, that a structured data islands is the embedding of the JSON-LD data into a normal HTML document via the script tag. The playground seems to read the remote document as pure HTML and does not extract the JSON-LD data from the script tag.

To visualize and check the JSON-LD data in my page, I use this checker:
https://search.google.com/test/rich-results

I would be nice, if the playground would try to use the embedded JSON-LD data in remote documents.

@gkellogg
Copy link
Member

@davidlehn this should be possible, given the inherent support in jsonld.js. Presumably need an option to set the mime type to invoke that part of the algorithm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants