Wednesday, July 17, 2013

RDFa is (still) the best way to improve your SEO

The web is getting better and better.  Search is getting smarter.  Google's 'rich snippets' and Facebook's Open Graph Protocol are great examples of how the industry is helping web developers make their content more machine-readable.  Industry-standard 'vocabularies' like FOAF, Dublin Core Terms, Good Relations, and Schema.org are helping developers ensure that their content just makes sense. And all of those technologies are based largely upon, and designed to support other technologies that use, RDF.

What is RDF?  RDF stands for "Resource Description Framework", and an excellent overview of it is in the RDF Primer the W3C has published.  If you don't want to dig that deeply, just know that RDF is a method for describing in a very standard way the relationship between x and y.  Moreover, it can also describe the relationship between y and z.  And so on and so on, until you get all the way down to some well-known, standardized 'term' that has absolute meaning to something like the Google search engine.

How is this useful?  Well, it means in part that I can say something like "Shane McCarron is the author of this article".  And, because the concept of an author is a well-known, standardized 'term' that has an absolute meaning, and because this article has a permanent URI, anything that can understand RDF will immediately *know* this.  Further, if I also say "Shane McCarron" is identified by some other URI (e.g., http://blog.halindrome.com) RDF-aware processors will automatically associate the author with that URI.

That's all great, I hear you saying.  But how do I, as a web developer, *tell* Google things about my web pages?  Enter RDFa.  RDFa stands for "RDF in attributes" (some people might argue about that, but I was in the room and that's what I remember).  It is a way to embed RDF information right into your web page in a pretty straightforward way.  And, if you do it right, it means that search engines like Google and Facebook will know *more* about your web site and its information than they will know about your less-savvy competitors who don't bother to put this data in.

There are a lot of great resources out on the web that can help you get your annotations right.  I have included a list of some at the end of this article.  However, just to get you started, here is a simple example.

Let's say you have a picture you want to include on your web site.  You want people to be able to use that picture, but you want them to know what it is a picture of and who took it.  You could say something like:

<span about="#myPicture">
<img id="myPicture" 
     alt="Cabin on the lake"
     src="http://www.example.com/images/picture.png">
<span property="dc:title">Cabin on the lake</span> by
<span property="dc:creator">Shane McCarron</span>
</span>

In that example we use terms from the "Dublin Core" vocabulary.  These are well-known terms.  Any knowledge engine will know exactly what you are talking about.  If you wanted to be more explicit about who the creator was, you might extend that definition like:

<span about="#myPicture">
<img id="myPicture"
     alt="Cabin on the lake"
     src="http://www.example.com/images/picture.png">
<span property="dc:title">Cabin on the lake</span> by
<span rel="dc:creator"
      typeof="foaf:Person">
   <span rel="foaf:homepage"
         href="http://blog.halindrome.com"
         property="foaf:name">Shane McCarron</span>
</span>
</span>

Now we have also mixed in some terms from the "Friend of a Friend" vocabulary to say that the dc:creator we talked about before is a "Person" who has a "homepage" and a "name".  These are also well-known terms and will help the knowledge engines make better inferences about who "Shane McCarron" is.  If there are other things out there for which a 'foaf:Person' with those attributes is listed as the 'dc:creator', they were likely created by the same "Shane McCarron".  

There are LOTS of ways to use RDFa in your web pages and articles.  I plan to write more on this in the coming weeks.  For now, here are some resources that can help you get started.


Next up: How the W3C is using RDFa to help ensure its own documents are well annotated.


RDFa is (still) the best way to improve your SEO by Shane McCarron