2

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?

unor
  • 92,415
  • 26
  • 211
  • 360
msp
  • 3,272
  • 7
  • 37
  • 49
  • How strict is the requirement of using RDFa? Wouldn't microdata (e.g. http://www.google.com/webmasters/tools/richsnippets?q=uploaded:8005017622991458aa89ac7e7ba39b5e) be the better option in this case? – Ilya Streltsyn Aug 25 '14 at 15:52
  • Thanks, @IlyaStreltsyn - microdata would be the fallback option if it can't be done with RDFa. – msp Aug 25 '14 at 16:19

2 Answers2

4

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>
unor
  • 92,415
  • 26
  • 211
  • 360
  • thanks, I've tried this before with no success. Your provided code validates however, the strange thing is that this stops working as soon as you add the vocab="http://schema.org/" attribute. – msp Aug 26 '14 at 07:04
  • 2
    @msparer: Yes, `vocab` defines a vocabulary that can be used without any prefix. Because of that, "nofollow" is considered to be part of the vocabulary. So the solution is *not* to use `vocab`. Use the `prefix` attribute instead. But, described in my answer, it’s optional for Schema.org (and the other vocabularies defined in the RDFa Core Initial Context). -- In an [answer on Webmasters](http://webmasters.stackexchange.com/a/67264/17633) I made three short examples about `vocab` vs. `prefix` vs. Intial Context. – unor Aug 26 '14 at 12:52
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".)

niklasl
  • 21
  • 1