I have a website where the client requests JSON-LD (not microdata) schema.org tags. One of the things they want is a basic "WebPage" tag on each page that contains some information about the content on each page. The other is "FAQPage", which is only added on specific FAQ pages. Both will be added directly to the page as inline script tags.
FAQPage inherits from WebPage and therefore contains all properties of WebPage.
If I just had the footer code generate the "WebPage" tag, and the FAQ component generate the "FAQPage" tag, both would end up on the page as separate JSON-LD script tags - I believe this would be interpreted as Two separate "web pages" - not what we are looking for. p>
Is it possible to mark schema tags so that two JSON-LD tags represent "extensions" of each other? Since FAQPage inherits WebPage, I would like a way to set an identifier to show that both are the same page being logged.
(Yes, I could use logic on the backend to "pass" information about the FAQPage into the footer and have the footer component dynamically output the FAQPage or WebPage, but that's not what I'm looking for here.) p>
@id
Keyword can be used for this. It provides an identifier in the form of an IRI (or a blank node identifier) for the node object.Node objects with the same
@id
value are the same thing, regardless of whether the types of these things have an inheritance relationship.These IRIs do not have to be resolved into documents on the web. If they do, you should make sure distinguish the thing and the documentation about that thing.
However, in your specific case, the thing and the documentation about it actually mean the same thing. Therefore, you can use the canonical IRI of the page as
@id
:If the objects represent the same thing, but have different
@id
values, you can use the attributeowl:sameAs
. But consumers who only support Schema.org won't realize this. (Schema.org also has asameAs
attribute, but it has a different meaning. )