Est-ce une bonne façon de coder JSON-LD pour JobPosting
de Schema.org?
Je place un certain nombre d'éléments JobPosting
dans le même fichier. Est-ce que cela fonctionne correctement? Est-ce correct?
<script type="application/ld+json"> {
"@context" : "http://schema.org/",
"@type" : "JobPosting",
"title" : "Job1",
"description" : "",
"datePosted" : "2018-10-26",
"validThrough" : "2018-11-02",
"hiringOrganization": {
...
},
"jobLocation": {
"@type": "Place",
"address": {
...
}
},
}
</script>
<script type="application/ld+json"> {
"@context" : "http://schema.org/",
"@type" : "JobPosting",
"title" : "Job2",
"description" : "",
"datePosted" : "2018-10-26",
"validThrough" : "2018-11-02",
"hiringOrganization": {
...
},
"jobLocation": {
"@type": "Place",
"address": {
...
}
},
}
</script>
<script type="application/ld+json"> {
"@context" : "http://schema.org/",
"@type" : "JobPosting",
"title" : "Job3",
"description" : "",
"datePosted" : "2018-10-26",
"validThrough" : "2018-11-02",
"hiringOrganization": {
...
},
"jobLocation": {
"@type": "Place",
"address": {
...
}
},
}
</script>
.
.
.
.
.
<script type="application/ld+json"> {
"@context" : "http://schema.org/",
"@type" : "JobPosting",
"title" : "job - n",
"description" : "",
"datePosted" : "2018-10-26",
"validThrough" : "2018-11-02",
"hiringOrganization": {
...
},
"jobLocation": {
"@type": "Place",
"address": {
...
}
},
}
</script>
C'est correct de le faire, mais vous pouvez aussi simplement utiliser un tableau:
<script type="application/ld+json">
[{
"@context": "http://schema.org/",
"@type": "JobPosting",
"title": "Job1",
"description": "",
"datePosted": "2018-10-26",
"validThrough": "2018-11-02",
"hiringOrganization": {
...
}
,
"jobLocation": {
"@type": "Place",
"address": {
...
}
}
},
{
"@context": "http://schema.org/",
"@type": "JobPosting",
"title": "Job2",
"description": "",
"datePosted": "2018-10-26",
"validThrough": "2018-11-02",
"hiringOrganization": {
...
}
,
"jobLocation": {
"@type": "Place",
"address": {
...
}
}
}]
</script>
Plus d'infos: https://stackoverflow.com/questions/30723531/best-json-ld-practices-using-multiple-script-elements