Rich Snippets: rel="nofollow" and RDFa
Asked Answered
R

2

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?

Roccoroch answered 25/8, 2014 at 14:52 Comment(2)
How strict is the requirement of using RDFa? Wouldn't microdata (e.g. google.com/webmasters/tools/…) be the better option in this case?Herrle
Thanks, @IlyaStreltsyn - microdata would be the fallback option if it can't be done with RDFa.Roccoroch
U
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>
Uglify answered 25/8, 2014 at 21:54 Comment(2)
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="schema.org" attribute.Roccoroch
@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 I made three short examples about vocab vs. prefix vs. Intial Context.Uglify
B
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".)

Balmung answered 6/10, 2014 at 8:33 Comment(1)
Even using <a vocab rel="nofollow" Spectre

© 2022 - 2024 — McMap. All rights reserved.