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

Support referencing schemas using @id #21

Open
iaincollins opened this issue Apr 14, 2020 · 0 comments
Open

Support referencing schemas using @id #21

iaincollins opened this issue Apr 14, 2020 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@iaincollins
Copy link
Owner

Summary of proposed feature
Allow @id to be used to reference one schema from another schema on the same page.

Purpose of proposed feature
This format exists to publishers to avoid repeating the same information.

It is valid syntax used by some publishers (although it is not especially common).

For a more detailed explanation, see:
https://webmasters.stackexchange.com/questions/98569/what-is-the-use-of-id-in-json-ld-syntax

Detail of the proposed feature

e.g. markup for a news article might look like:

{
  "@context": "http://schema.org",
  "@type": "NewsArticle",
  "publisher": {
    "@id": "https://www.nytimes.com/#publisher"
 }

And it might reference an organisation object on a page which looks like like this:

{
  "@context": "http://schema.org",
  "@type": "NewsMediaOrganization",
  "@id": "https://www.nytimes.com/#publisher",
  "name": "The New York Times",
  "logo": {
    "@context": "http://schema.org",
    "@type": "ImageObject",
    "url": "https://static01.nyt.com/images/misc/NYT_logo_rss_250x40.png",
    "height": 40,
    "width": 250
  },
}

For a real world, example, see:
https://www.nytimes.com/2020/04/14/us/coronavirus-updates-usa.html

Potential problems

This could be done by either making the test logic more sophisticated or (perhaps more easily?) by 'unflattening' the data structures after parsing the page, which would mean the test logic doesn't need to change, and that could be better as it would be much simpler logic and avoid special case handling for this feature in an already complicated section of code.

Describe any alternatives you've considered

None

Additional context

None

@iaincollins iaincollins added the enhancement New feature or request label Apr 14, 2020
@iaincollins iaincollins added this to the Version 5.0 milestone Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant