我正在使用Rich Snippets根据schema.org上的集合标记我的内容。我正在使用RDFa Lite这样做,现在我遇到了rel
属性的问题。我的一些链接确实具有rel="nofollow"
属性/值。由于RDFa Lite是RDFa的子集,因此rel
属性被识别为附加标记。有关以下标记的提取数据,请参阅this upload to Google's Structured Data Testing Tool:
<div vocab="http://schema.org/" typeof="SportsTeam">
<span property="name">San Francisco 49ers</span>
<div property="member" typeof="OrganizationRole">
<div property="member" typeof="http://schema.org/Person">
<span property="name">Joe Montana</span>
</div>
<span property="startDate">1979</span>
<span property="endDate">1992</span>
<span property="namedPosition">Quarterback</span>
<a rel="nofollow" href="http://www.google.com/">A Paid Link</a>
</div>
问题当然是付费链接不应出现在结构化标记中。任何想法如何解决这个问题?
答案 0 :(得分:4)
一种可能性是使用Schema.org用法的前缀。由于RDFa Core Initial Context为schema
定义了http://schema.org/
,您甚至可以使用它而不首先在prefix
属性中指定它:
<div typeof="schema:SportsTeam">
<span property="schema:name">San Francisco 49ers</span>
<div property="schema:member" typeof="schema:OrganizationRole">
<div property="schema:member" typeof="schema:Person">
<span property="schema:name">Joe Montana</span>
</div>
<span property="schema:startDate">1979</span>
<span property="schema:endDate">1992</span>
<span property="schema:namedPosition">Quarterback</span>
<a rel="nofollow" href="http://www.google.com/">A Paid Link</a>
</div>
答案 1 :(得分:2)
您可以在使用vocab=""
的元素上(或周围)添加空rel
用于RDFa之外的目的。像:
<div vocab="http://schema.org/" typeof="SportsTeam">
<span property="name">San Francisco 49ers</span>
<div property="member" typeof="OrganizationRole">
<div property="member" typeof="http://schema.org/Person">
<span property="name">Joe Montana</span>
</div>
<span property="startDate">1979</span>
<span property="endDate">1992</span>
<span property="namedPosition">Quarterback</span>
<a vocab="" rel="nofollow" href="http://www.google.com/">A Paid Link</a>
</div>
(另请注意,如果您只是在同一元素上添加rel
,则可以在HTML中使用自定义(非URI)property
值和RDFa值(这会使RDFa处理器忽略{{ 1}},如extension 7 of RDFa 1.1 in HTML中所定义。)例如,在rel
旁边添加property="author"
。)