3

Is this what is supposed to happen? If so, why?

Here's an example (test code here):

<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "WebPage",
    "@id": "http://example.com/"
}
</script>
<script type="application/ld+json">
{
 "@context": "http://schema.org",
 "@type": "BreadcrumbList",
 "itemListElement":{
   "@type": "ListItem",
   "position": 1,
   "item":{
    "@id": "http://example.com/",
    "name": "Lecture 12: Graphs, networks, incidence matrices"
    }
  }
}
</script>
3

Yes, I think it makes sense that Google’s SDTT does this. It’s just a usability question if the WebPage item should be displayed as top-level item in addition; it doesn’t affect the semantics.

In the first script data block, you say that the WebPage has the URI http://example.com/. In the second script data block, you say that the value of the item property has the same URI, http://example.com/.
Because these two items have the same URI, they have to be the same thing.

You may want to use the breadcrumb property to make clear that the BreadcrumbList belongs to the WebPage:

<script type="application/ld+json">
{
 "@context": "http://schema.org",
 "@type": "WebPage",
 "@id": "http://example.com/",
 "breadcrumb": {
   "@type": "BreadcrumbList",
   "itemListElement":{
     "@type": "ListItem",
     "position": 1,
     "item":{
      "@id": "http://example.com/",
      "name": "Lecture 12: Graphs, networks, incidence matrices"
      }
    }
  }
}
</script>

As you can see in the SDTT, the properties you provide for the item property will be displayed under the top-level WebPage item.

(N.B.: Google’s SDTT seems to be bugged for cases where different types get provided for the same URI.)

  • "You may want to use the breadcrumb property to make clear that the BreadcrumbList belongs to the WebPage." That seems to make the most sense. What would you recommend for Article types? The top level item really doesn't matter? – John R Perry Oct 9 '16 at 20:28
  • 1
    @JohnRPerry: Personally (because I like to be expressive with my structured data) I always use a WebPage type; if it’s a page with a single Article, I have: ItemPage mainEntity Article and ItemPage breadcrumb BreadcrumbList. -- Regarding top-level items: From the perspective of Schema.org, it doesn’t matter. I think there was a time when Google only displayed Rich Snippets for top-level items, but I think this is no longer the case (I’m not sure though, as I don’t care about it). – unor Oct 9 '16 at 20:39
  • Last question: I never really paid attention to the URI because schema.org doesn't really include it in their example markup, but it seems to function like a canonical tag. Do you use it in your own work? – John R Perry Oct 9 '16 at 21:39
  • @JohnRPerry: That topic is somewhat complex (and Schema.org decided to omit it in their examples/documentation because of this). In short: If you want to follow best practices of the Semantic Web / Linked Data, you should use the canonical URI of the page only for the WebPage item, and a different URI for the thing that gets described on the page. Details: example what Apple does ·· explanation why/how to differentiate. – unor Oct 9 '16 at 22:07
  • Okay thank you very much. Sorry one more final question, I promise: if you're adding markup to a blog post and ItemPage is the top-level and Article is the mainEntity does Article or ItemPage get the name, url, description, etc. If this should be asked as a unique question entirely, let me know. – John R Perry Oct 9 '16 at 22:17
0

Think of ID as a global variable, the first time you "declare" its value, this value is set througout the document and will "render" the given value anywhere you call the ID.

<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "WebPage",
    "@id": "http://example.com/" *here you give ID a value*
}
</script>
<script type="application/ld+json">
{
 "@context": "http://schema.org",
 "@type": "BreadcrumbList",
 "itemListElement":{
   "@type": "ListItem",
   "position": 1,
   "item":{
    "@id": "http://example.com/", *here you just "paste" the given value*
    "name": "Lecture 12: Graphs, networks, incidence matrices"
    }
  }
}
</script>

That's why you literally get a full URL within a breadcrumb trail.

In fact IDs should be VERY consistent domainwise in order to disambiguate entities and actually spare the effort of having to declare one time and another the same thing, like repeating several times a homepage URL or very likely a postalAdress if you do content about LocalBusiness and other types of Organization.

A big benefit is that other authors may reference this ID from extrnal sites/domains and even then this will be an univocal relation. Think big, kinda semantic link building (out of scope, just an example of possible use).

You can find a working example in ZeClinics contact page where I am hashing the 2 premises of the company in order to set a precedent to be recalled in future RDF and onpage Schema developments.

Furthermore, if you are using CMS for website maintenance I would perhaps advise to implement Breadcrumb with RDFa (my favorite vs Microdata) and keep this trail apart from the far more flexible (and thus complex) JSON-LD scripts.

This is absolutely common in many WP themes, for example.
Have fun!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.