Skip to content

Instantly share code, notes, and snippets.

@jdevalk
Last active May 7, 2019 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jdevalk/d8992a2706e67a53a0a87fce10dd55ab to your computer and use it in GitHub Desktop.
Save jdevalk/d8992a2706e67a53a0a87fce10dd55ab to your computer and use it in GitHub Desktop.
Two JSON blobs, one with the main product, a second one that can be output later on the page that clearly relates itself to the first one as a related product.
<script type="application/ld+json">{
"@context": "https://schema.org",
"@graph": [
{
"@type": "Organization",
"@id": "https://example.com/#organization",
"name": "Yoast",
"url": "https://example.com/",
"sameAs": [
"https://www.facebook.com/yoast",
"https://www.linkedin.com/company/yoast-com/",
"https://en.wikipedia.org/wiki/Yoast",
"https://twitter.com/yoast"
],
"logo": {
"@type": "ImageObject",
"@id": "https://example.com/#logo",
"url": "https://example.com/wp-content/uploads/2019/03/Yoast_Logo_tagline_Large_RGB.png",
"caption": "Yoast"
},
"image": {
"@id": "https://example.com/#logo"
}
},
{
"@type": "WebSite",
"@id": "https://example.com/#website",
"url": "https://example.com/",
"name": "one.wordpress.test",
"publisher": {
"@id": "https://example.com/#organization"
},
"potentialAction": {
"@type": "SearchAction",
"target": "https://example.com/?s={search_term_string}",
"query-input": "required name=search_term_string"
}
},
{
"@type": "ItemPage",
"@id": "https://example.com/product/vneck-tee/#webpage",
"url": "https://example.com/product/vneck-tee/",
"inLanguage": "en-US",
"name": "Vneck Tshirt - one.wordpress.test",
"isPartOf": {
"@id": "https://example.com/#website"
},
"image": {
"@type": "ImageObject",
"@id": "https://example.com/product/vneck-tee/#primaryimage",
"url": "https://example.com/wp-content/uploads/2019/03/vneck-tee.jpg",
"caption": ""
},
"primaryImageOfPage": {
"@id": "https://example.com/product/vneck-tee/#primaryimage"
},
"datePublished": "2019-03-27T15:16:56+00:00",
"dateModified": "2019-04-09T09:08:35+00:00",
"description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor",
"breadcrumb": {
"@id": "https://example.com/product/vneck-tee/#breadcrumb"
}
},
{
"@type": "BreadcrumbList",
"@id": "https://example.com/product/vneck-tee/#breadcrumb",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"item": {
"@type": "WebPage",
"@id": "https://example.com/",
"url": "https://example.com/",
"name": "Home"
}
},
{
"@type": "ListItem",
"position": 2,
"item": {
"@type": "WebPage",
"@id": "https://example.com/shop/",
"url": "https://example.com/shop/",
"name": "Products"
}
},
{
"@type": "ListItem",
"position": 3,
"item": {
"@type": "WebPage",
"@id": "https://example.com/product/vneck-tee/",
"url": "https://example.com/product/vneck-tee/",
"name": "Vneck Tshirt"
}
}
]
},
{
"@type": "Product",
"@id": "https://example.com/product/vneck-tee/#product",
"name": "Vneck Tshirt",
"url": "https://example.com/product/vneck-tee/",
"image": {
"@id": "https://example.com/product/vneck-tee/#primaryimage"
},
"description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
"sku": 83,
"offers": [
{
"@type": "Offer",
"price": "18.00",
"priceValidUntil": "2020-12-31",
"priceSpecification": {
"price": "18.00",
"priceCurrency": "EUR",
"valueAddedTaxIncluded": "false"
},
"priceCurrency": "EUR",
"availability": "https://schema.org/InStock",
"url": "https://example.com/product/vneck-tee/",
"seller": {
"@id": "https://example.com/#organization"
}
}
],
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.50",
"reviewCount": 2
},
"review": [
{
"@id": "https://example.com/product/vneck-tee/#comment-5",
"datePublished": "2019-04-09T09:10:12+00:00",
"description": "What a nice turtle shirt.",
"reviewRating": {
"@type": "Rating",
"ratingValue": "4"
},
"author": {
"@type": "Person",
"name": "Tim"
}
},
{
"@id": "https://example.com/product/vneck-tee/#comment-6",
"datePublished": "2019-04-09T09:10:29+00:00",
"description": "Awesome shirt",
"reviewRating": {
"@type": "Rating",
"ratingValue": "5"
},
"author": {
"@type": "Person",
"name": "Patrice"
}
}
],
"brand": {
"@type": "Organization",
"name": "Turtle"
},
"manufacturer": {
"@type": "Organization",
"name": "Turtle"
},
"mainEntityOfPage": {
"@id": "https://example.com/product/vneck-tee/#webpage"
}
}
] }</script>
<script type="application/ld+json">
"@context": "https://schema.org",
"@graph": [
{
"@type": "Product",
"@id": "https://example.com/product/vneck-tee/#product2",
"name": "Vneck Tshirt 2",
"url": "https://example.com/product/vneck-tee/#2",
"image": {
"@id": "https://example.com/product/vneck-tee/#primaryimage"
},
"description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
"sku": 83,
"offers": [
{
"@type": "Offer",
"price": "18.00",
"priceValidUntil": "2020-12-31",
"priceSpecification": {
"price": "18.00",
"priceCurrency": "EUR",
"valueAddedTaxIncluded": "false"
},
"priceCurrency": "EUR",
"availability": "https://schema.org/InStock",
"url": "https://example.com/product/vneck-tee/",
"seller": {
"@id": "https://example.com/#organization"
}
}
],
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.50",
"reviewCount": 2
},
"review": [
{
"@id": "https://example.com/product/vneck-tee/#comment-5",
"datePublished": "2019-04-09T09:10:12+00:00",
"description": "What a nice turtle shirt.",
"reviewRating": {
"@type": "Rating",
"ratingValue": "4"
},
"author": {
"@type": "Person",
"name": "Tim"
}
},
{
"@id": "https://example.com/product/vneck-tee/#comment-6",
"datePublished": "2019-04-09T09:10:29+00:00",
"description": "Awesome shirt",
"reviewRating": {
"@type": "Rating",
"ratingValue": "5"
},
"author": {
"@type": "Person",
"name": "Patrice"
}
}
],
"brand": {
"@type": "Organization",
"name": "Turtle"
},
"manufacturer": {
"@type": "Organization",
"name": "Turtle"
},
"isRelatedTo": {
"@id": "https://example.com/product/vneck-tee/#product"
}
}
]
}</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment