38 lines
966 B
Python
38 lines
966 B
Python
|
|
|
|
def get_ld_speakebale(name, theme_xpath, info_xpath, url):
|
|
|
|
data = {
|
|
"@context": "https://schema.org/",
|
|
"@type": "WebPage",
|
|
"name": name,
|
|
"speakable": {
|
|
"@type": "SpeakableSpecification",
|
|
"xPath": [
|
|
theme_xpath,
|
|
info_xpath
|
|
]
|
|
},
|
|
"url": url
|
|
}
|
|
|
|
return data
|
|
|
|
# <title>Speakable markup example</title>
|
|
# <meta name="description" content="This page is all about the quick brown fox" />
|
|
# <script type="application/ld+json">
|
|
# {
|
|
# "@context": "https://schema.org/",
|
|
# "@type": "WebPage",
|
|
# "name": "Quick Brown Fox",
|
|
# "speakable":
|
|
# {
|
|
# "@type": "SpeakableSpecification",
|
|
# "xPath": [
|
|
# "/html/head/title",
|
|
# "/html/head/meta[@name='description']/@content"
|
|
# ]
|
|
# },
|
|
# "url": "http://www.quickbrownfox_example.com/quick-brown-fox"
|
|
# }
|
|
# </script> |