Speakable structured data snippet in json
Mark E.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebPage",
"name": "Sample Article",
"url": "https://www.example.com/sample-article",
"speakable": {
"@type": "SpeakableSpecification",
"xpath": [
"/html/head/title",
"/html/head/meta[@name='description']/@content",
"/html/body/h1",
"/html/body/p[1]",
"/html/body/p[2]"
]
}
}
</script>
In this example, the SpeakableSpecification
is used to indicate which parts of the webpage can be read aloud by a text-to-speech device. The xpath
property is an array of XPath expressions that target specific elements on the page that should be included in the spoken content. In this case, the SpeakableSpecification
includes the page title, meta description, the first heading (h1
), and the first two paragraphs (p
) of the page content.