Mobile app version of vmapp.org
Login or Join
Caterina187

: How to write JSON-LD for list of people? 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

@Caterina187

Posted in: #Html #JsonLd #SchemaOrg

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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Caterina187

2 Comments

Sorted by latest first Latest Oldest Best

 

@Shanna517

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>

10% popularity Vote Up Vote Down


 

@Kaufman445

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"
}
}
]
}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme