Add Structured Data to Your Blog

Structured data

You’ve probably heard of Structured Data, it comes in several different formats, microdata, microformats, RDFa / RDFa Lite but Google are now officially recommending that you use the microdata format.

By using Structured Data, you’re allowing search engines and bots to produce “Rich Snippets” from your data, as the structure and semantic meaning is defined.

Microdata

If you want to upset yourself, you can lose a few days reading the W3C HTML Microdata Draft, or you can just carry on reading and I’ll show you how simple it really is.

This blog

Let’s take this blog as an example. I’ve followed the Schema.org BlogPosting schema to enrich each blog post with microdata. This enables search engines to understand the structure of the blog post and what the data actually means.

Without microdata
1
2
3
4
5
6
7
8
9
10
11
12
13
<article class="post">
<div class="post-content">
<header>
<div class="icon"></div>
<time datetime="2013-10-25T09:45:35.000Z">25th Oct 2013</time>
<h1 class="title">Add Structured Data to Your Blog</h1>
</header>
<div class="entry">
<h2>Structured data</h2>
...
</div>
</div>
</article>
With microdata
1
2
3
4
5
6
7
8
9
10
11
12
13
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
<div class="post-content">
<header>
<div class="icon"></div>
<time datetime="2013-10-25T09:45:35.000Z" itemprop="datePublished">25th Oct 2013</time>
<h1 class="title" itemprop="name headline">Add Structured Data to Your Blog</h1>
</header>
<div class="entry" itemprop="articleBody">
<h2>Structured data</h2>
...
</div>
</div>
</article>

There are 2 main differences:

  • I have added itemscope and itemtype attributes to the top level article element, which allows bots to understand that I’m writing a blog post and that I’m following the Schema.org standard.
  • I have added various itemprop attributes to certain elements within the article. This allows bots to understand which element relates to which property from Schema.org. Please note, you don’t need to use every property on Schema.org(!), just pick what is appropriate to your content.

Testing

You’ll want to ensure that what you’ve done is right. Fortunately, Google have a free Rich Snippets testing tool. You can see the results for this blog here. You should also double check that your HTML is still valid using the W3C Validator.

There will be a day when you ALWAYS use structured data, make that day today.