Despite this being the premier JSON-LD library for python, the examples are sparse and leave a lot to the imagination. Or maybe it's just me. In frustration I ended up resorting to dicts and json for now, but wanted to see if we could get some more examples and documentation up.
Here are examples of outputting jsonld Google's way:
https://developers.google.com/search/docs/guides/
Breadcrumbs: https://developers.google.com/search/docs/data-types/breadcrumbs
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "https://www.example.com/",
"potentialAction": [{
"@type": "SearchAction",
"target": "https://query.example.com/search?q={search_term_string}",
"query-input": "required name=search_term_string"
},{
"@type": "SearchAction",
"target": "android-app://com.example/https/query.example.com/search/?q={search_term_string}",
"query-input": "required name=search_term_string"
}]
}
</script>
https://developers.google.com/search/docs/data-types/logo
{
"@context": "http://schema.org",
"@type": "Organization",
"url": "http://www.example.com",
"logo": "http://www.example.com/images/logo.png"
}
https://developers.google.com/search/docs/data-types/articles
{
"@context": "http://schema.org",
"@type": "NewsArticle",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://google.com/article"
},
"headline": "Article headline",
"image": {
"@type": "ImageObject",
"url": "https://google.com/thumbnail1.jpg",
"height": 800,
"width": 800
},
"datePublished": "2015-02-05T08:00:00+08:00",
"dateModified": "2015-02-05T09:20:00+08:00",
"author": {
"@type": "Person",
"name": "John Doe"
},
"publisher": {
"@type": "Organization",
"name": "Google",
"logo": {
"@type": "ImageObject",
"url": "https://google.com/logo.jpg",
"width": 600,
"height": 60
}
},
"description": "A most wonderful article"
}
Despite this being the premier JSON-LD library for python, the examples are sparse and leave a lot to the imagination. Or maybe it's just me. In frustration I ended up resorting to dicts and json for now, but wanted to see if we could get some more examples and documentation up.
Here are examples of outputting jsonld Google's way:
https://developers.google.com/search/docs/guides/
Breadcrumbs: https://developers.google.com/search/docs/data-types/breadcrumbs
https://developers.google.com/search/docs/data-types/logo
{ "@context": "http://schema.org", "@type": "Organization", "url": "http://www.example.com", "logo": "http://www.example.com/images/logo.png" }https://developers.google.com/search/docs/data-types/articles
{ "@context": "http://schema.org", "@type": "NewsArticle", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://google.com/article" }, "headline": "Article headline", "image": { "@type": "ImageObject", "url": "https://google.com/thumbnail1.jpg", "height": 800, "width": 800 }, "datePublished": "2015-02-05T08:00:00+08:00", "dateModified": "2015-02-05T09:20:00+08:00", "author": { "@type": "Person", "name": "John Doe" }, "publisher": { "@type": "Organization", "name": "Google", "logo": { "@type": "ImageObject", "url": "https://google.com/logo.jpg", "width": 600, "height": 60 } }, "description": "A most wonderful article" }