| html_json_ld | R Documentation |
The structured data pages embed as JSON-LD: the text of each
<script type="application/ld+json"> below the given nodes (and the
nodes themselves), in document order. The type is matched as a MIME
type: case-insensitively, ignoring surrounding whitespace and any
parameters.
html_json_ld(x, parse = FALSE)
x |
A |
parse |
If |
With parse = FALSE, a character vector: the text of each
block, exactly as written. With parse = TRUE, a list as long as that
vector: each block's parsed value, or NULL for a block that is not
valid JSON; the texts are kept in its attribute "json".
Other metadata:
html_meta(),
html_microdata(),
html_title()
doc <- html_parse(paste0(
"<script type='application/ld+json'>",
'{"@context": "https://schema.org", "@type": "Person", "name": "Ada"}',
"</script>"
))
html_json_ld(doc)
if (requireNamespace("jsonlite", quietly = TRUE)) {
html_json_ld(doc, parse = TRUE)[[1]]$name
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.