我想使用schema.org格式化一组文章,但文章不是只是文本。它们包含链接,<em>
s,<strong>
和其他轻量级标记。如何正确地将其放入text
属性?
我考虑过将标记放在那里,当它在带注释的HTML中时有意义:
<div itemscope itemtype="http://schema.org/CreativeWork">
<h1 itemprop="name">An example I just wrote</h1>
<p itemprop="text">here's a <a href="http://example.com">link</a>, it's very <em>important</em></p>
</div>
但如果我将其存储为JSONLD,假设文本应该被解释为HTML将是相当奇怪的:
{
"@context": "http://schema.org",
"@type": "CreativeWork",
"name": "An example I just wrote"
"text": "here's a <a href=\"http://example.com\">link</a>, it's very <em>important</em>"
}
我完全有可能用Markdown写作:
{
"@context": "http://schema.org",
"@type": "CreativeWork",
"name": "An example I just wrote"
"text": "here's a [link](http://example.com), it's very _important_"
}
或任何其他能够表达相同想法的语言。 我正在使用的语言相当重要,因为它表明应该如何阅读文本。
答案 0 :(得分:2)
如果您想明确说明您使用的语言,可以type the value。上面的代码片段使用rdf:HTML datatype:
看起来有点像这样{
"@context": "http://schema.org",
"@type": "CreativeWork",
"name": "An example I just wrote"
"text": {
"@value": "here's a <a href=\"http://example.com\">link</a>, it's very <em>important</em>",
"@type": "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML"
}
}