3

I have a page that contains a list of people with a link of each that will open the main page of that person.

Each link should have its own structured data.

I'm using JSON-LD, but the example given is in Microdata format. So to write it in JSON-LD format, should I write the complete scripts for each URL?

The script for one URL is

  <script type="application/ld+json">
  {
  "@context": "http://schema.org",
  "@type": "Person",
  "address": {
    "@type": "PostalAddress",
    "addressLocality": "Seattle",
    "addressRegion": "WA",
    "postalCode": "98052",
    "streetAddress": "20341 Whitworth Institute 405 N. Whitworth"
  },
  "colleague": [
    "http://www.xyz.edu/students/alicejones.html",
    "http://www.xyz.edu/students/bobsmith.html"
  ],
  "email": "mailto:jane-doe@xyz.edu",
  "image": "janedoe.jpg",
  "jobTitle": "Professor",
  "name": "Jane Doe",
  "telephone": "(425) 123-4567",
  "url": "http://www.janedoe.com"
}
</script>

Let's say I have a list of 15 persons on one page. Should I write these 15 scripts separately or there's some other way to write JSON-LD in that case?

unor
  • 21,739
  • 3
  • 46
  • 117
sirajalam049
  • 223
  • 3
  • 11

2 Answers2

5

You have several options:

  • as top-level items
    (only use this if the other two options are not possible)
  • as values for a property
    (best option, but requires that Schema.org offers a suitable type/property for your case)
  • as ItemList
    (second-best option; requires that it makes sense to group them)

As top-level items

If you want to provide the Person items as top-level items (i.e., not nested as values for a property of some other type), you can either use multiple script elements, or one script element with @graph:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Person"
}
</script>

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Person"
}
</script>
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@graph": 
  [
    {
       "@type": "Person"
    },
    {
       "@type": "Person"
    }
  ]
}
</script>

As values for a property

If you want to provide the Person items as values for a property of some other type, use an array as value.

Example case: You could have an Organization and want to reference the employed Persons with the employee property:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Organization",
  "employee":
  [
    {
      "@type": "Person"
    },
    {
      "@type": "Person"
    }
  ]
}
</script>

As list

If you want to provide the Person items as list, you can use the ItemList type.

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "ItemList",
  "itemListElement": [
    {
      "@type": "Person"
    },
    {
      "@type": "Person"
    }
  ]
}
</script>
unor
  • 21,739
  • 3
  • 46
  • 117
0

You can apply a property BreadcrumbList for your list. Something like this:

{
 "@context": "http://schema.org",
 "@type": "BreadcrumbList", 
 "name": "Name of the list",
 "description": "Description of the list",
 "itemListElement":
 [
  {
   "@type": "ListItem",
   "position": 1,
   "item":
   {
    "@type": "Person",
    "@id": "https://example.com/person1",
    "name": "name of person1"
    }
  },
  {
   "@type": "ListItem",
  "position": 2,
  "item":
   {
     "@type": "Person",
    "@id": "https://example.com/person2",
     "name": "name of person2"
   }
  }
 ]
}
unor
  • 21,739
  • 3
  • 46
  • 117
  • 3
    A list of persons (e.g., on a team page), is not a breadcrumb list. Breadcrumbs are a type of navigation that either shows the parent pages of the current page, or the pages that were visited before. – unor Oct 21 '17 at 13:59
  • Right, I was going to comment the same thing. – sirajalam049 Oct 21 '17 at 18:50
  • @unor, at what page we use BreadcrumbList. Like, I have a link at home page to go to a page (say the category list) that contains employees List, machines List, project list as links of their list on some page (say the main list). Like employees list contains the list of all employees. And further, each employee is a link to the employee's profile on some page (say final page). So among these pages, which page is going to have json-ld script for BreadcrumbList ? – sirajalam049 Oct 21 '17 at 18:57
  • @Siraj: I think this should be a separate question, the comments are not the right place for it. – unor Oct 22 '17 at 03:31
  • @unor, description of BreadcrumbList: "A BreadcrumbList is an ItemList consisting of a chain of linked Web pages, typically described using at least their URL and their name...". In your question, you are asking how to partition structured data for a list with URL. My answer for this. –  Oct 22 '17 at 06:43
  • The description of BreadcrumbList is not really good for authors that don’t know what a breadcrumb navigation is (see the Wikipedia article Breadcrumb. Important is the term "chain". In this context, you would have a chain if the pages are organized in a hierarchy, or if you show the history of visited pages. -- Your snippet would be correct if you use ItemList (which is the parent type) instead of BreadcrumbList. – unor Oct 22 '17 at 13:55