Sub topic 15
How Microdata and RDFa differ
This chapter assumes you can write JSON-LD with @context, @type, and nested properties, and that you know basic HTML attributes. You will see how the two older syntaxes, Microdata and RDFa, express the same schema.org data, and when each one is the right choice.
Same vocabulary, different syntax
JSON-LD, Microdata, and RDFa can all carry schema.org types and properties. They differ in where the data lives. JSON-LD keeps it in a separate script element. Microdata and RDFa add attributes to the HTML elements that already show the content.
That difference gives each syntax a trade-off. Inline markup can't drift away from the visible text, because it is the text. But it is tied to the page layout, so a redesign can break it.
Microdata
Microdata is an HTML specification with three main attributes:
itemscopestarts a new entity.itemtypegives the schema.org type as a URL.itempropnames a property of the current entity.
Here is the author part of the earlier Article example, written as Microdata:
<article itemscope itemtype="https://schema.org/Article">
<h1 itemprop="headline">How to Brew Cold Coffee</h1>
<time itemprop="datePublished" datetime="2026-03-14T08:00:00+00:00">14 March 2026</time>
<div itemprop="author" itemscope itemtype="https://schema.org/Person">
<a itemprop="url" href="https://example.com/authors/ana">
<span itemprop="name">Ana Torres</span>
</a>
</div>
</article>Nesting works by putting itemscope on the element that is also an itemprop. The author div is both a property of the Article and the start of a Person.
RDFa
RDFa (Resource Description Framework in Attributes) is a W3C standard. Google and others read the RDFa 1.1 Lite subset, which uses these attributes:
vocabsets the default vocabulary.typeofgives the type of the entity.propertynames a property.resourcegives an identifier or a URL value.
<article vocab="https://schema.org/" typeof="Article">
<h1 property="headline">How to Brew Cold Coffee</h1>
<time property="datePublished" datetime="2026-03-14T08:00:00+00:00">14 March 2026</time>
<div property="author" typeof="Person">
<a property="url" href="https://example.com/authors/ana">
<span property="name">Ana Torres</span>
</a>
</div>
</article>The structure matches the Microdata version. RDFa has more features than Microdata, such as prefixes for mixing several vocabularies and resource for identifiers. In practice, schema.org markup rarely needs them.
Comparison
| Aspect | JSON-LD | Microdata | RDFa |
|---|---|---|---|
| Location | Separate `script` element | Attributes in the HTML | Attributes in the HTML |
| Tied to page layout | No | Yes | Yes |
| Linking with identifiers | `@id` | `itemid` | `resource` |
| Generated from data | Simple | Needs template changes | Needs template changes |
| Mismatch with visible text | Possible | Unlikely | Unlikely |
Which one to choose
Google recommends JSON-LD, and it is the easiest to generate and maintain. Choose Microdata or RDFa when a content management system or template already emits them, or when you want the markup bound to the exact elements that display the values.
Avoid mixing syntaxes for the same entity on one page. Two descriptions of one product can conflict, and consumers may read both.
Exercise
A team's product template already prints the price in a span. They want markup that cannot show a different price from the visible one. Which syntax fits better, JSON-LD or Microdata, and why?
Show answer
Microdata. Adding itemprop="price" to the existing span makes the markup read the visible value directly, so the two cannot differ. JSON-LD holds a separate copy of the price, which can go stale if only the template changes.