问题
I'm using Rich Snippets to markup my content according to the collections on schema.org. I am using RDFa Lite to do so and am now having a problem with the rel
attribute. Some of my links do have the rel="nofollow"
attribute/value. As RDFa Lite is a subset of RDFa, the rel
attribute gets recognised as additional markup. Please see this upload to Google's Structured Data Testing Tool for the extracted data for the following markup:
<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>
The problem is of course, that the Paid Link shouldn't appear in the structured markup. Any ideas how to solve this?
回答1:
One possibility is to use prefixes for your Schema.org usage. Because the RDFa Core Initial Context defines schema
for http://schema.org/
, you can even use it without specifying it in a prefix
attribute first:
<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>
回答2:
You can add an empty vocab=""
on (or around) the elements that use rel
for purposes outside of RDFa. Like:
<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>
(Also note that you can use custom (non-URI) rel
values alongside RDFa in HTML if you just add a property
on the same element (this makes an RDFa processor ignore the rel
, as defined in extension 7 of RDFa 1.1 in HTML). E.g. by adding property="author"
next to rel="me"
.)
来源:https://stackoverflow.com/questions/25488662/rich-snippets-rel-nofollow-and-rdfa