I want to show events on Google, so I have created this JSON-LD:
<script type="application/ld+json">
[{
"@context": "http://schema.org",
"@type": "TestEvent",
"name": "Rohit Patil Event",
"startDate": "2014-10-10T19:30",
"location": {
"@type": "Place",
"name": "Warner Theatre",
"address": "Washington, DC"
},
"offers": {
"@type": "Offer",
"url": "https://www.etix.com/ticket/1771656"
}
}
]
</script>
I have tested this in testing tool and having 0 error.
How can I use this code to work on Google? What is the best file to place this code?
3
Answers
You add the
script
element to the page about this event, either in thehead
or in thebody
.It becomes clearer if you use Microdata or RDFa instead of JSON-LD, because there you have to mark up your existing content. With JSON-LD you duplicate the content, but it still should be placed where the actual/visible content is.
You need to embed this into a webpage whose content is about the same event. You can find more information at:
https://developers.google.com/search/docs/guides/intro-structured-data#markup-formats-and-placement
JSON-LD is the recommended format by Google at this point btw.
In this case “the best file” to put that code is in the Rohit Patil Event file. It should go somewhere between the head section of that webpage. I.e.