# What Is RDFa and How Is It Used in Structured Data?

> What RDFa is, how it marks up data with vocab, typeof and property, how it differs from microdata and JSON-LD, and why og: tags come from it.

URL: https://clione.ai/glossary/rdfa/
Lang: en

Open a store's source code and look for `property="og:title"` in the head: that way of writing metadata comes from RDFa. RDFa is one of the three formats in which a page's [structured data](/glossary/structured-data/) can be written, the least known of the three, and **it is alive in more places than it seems**. It matters for two reasons: Google reads it like any other format, and if your theme or an old app uses it, it coexists with the markup you add later.

## How it works

The W3C published the current version, RDFa Core 1.1 in its third edition, as a recommendation on March 17, 2015. It defines it as **a specification of attributes for expressing structured data in any markup language**; the name comes from _RDF in Attributes_, the RDF data model written in attributes. Its idea is to reuse what the document already contains instead of repeating it somewhere else, and it defines thirteen attributes to do so.[^rdfa-core]

In practice almost nobody needs all thirteen. The same day, the W3C published RDFa Lite 1.1, a minimal subset for expressing machine-readable data in documents such as HTML, SVG or XML, with just five attributes:[^rdfa-lite]

| Attribute  | What it does                                                          |
| ---------- | --------------------------------------------------------------------- |
| `vocab`    | Says which vocabulary is used to describe what is on the page         |
| `typeof`   | Says what type the thing being described is                           |
| `property` | Names each property of that thing                                     |
| `resource` | Gives a unique identifier to each thing on the page                   |
| `prefix`   | Allows other vocabularies to be used when the main one lacks the term |

The most common vocabulary is [Schema.org](/glossary/schema-org/). RDFa Lite's own example describes a person with `vocab="http://schema.org/"` on a paragraph and marks their name and phone number with `property` on the visible text, so that **the sentence the visitor reads is the same one the search engine reads**.[^rdfa-lite]

Google supports three structured data formats. It describes RDFa as an HTML5 extension that adds attributes to the tags that correspond to visible content, and recommends [JSON-LD](/glossary/json-ld/) if your site allows it, because it is the easiest solution to implement and to maintain at scale.[^google-sd-intro] Recommending one is not the same as ignoring the others: well-done RDFa markup works for qualifying for [rich results](/glossary/rich-results/), and the [Rich Results Test](/glossary/rich-results-test/) **validates JSON-LD, RDFa and [microdata](/glossary/microdata/) alike**.[^rich-results-test]

### The inheritance you will actually see: Open Graph

The Open Graph protocol, the one behind the `og:` tags, was based on RDFa from its first version, which is why it is written with `meta` tags that use the `property` attribute in the page's head. It asks for four basic properties, `og:title`, `og:type`, `og:image` and `og:url`, and declares its vocabulary with the `prefix` attribute, the same one RDFa Lite defines.[^ogp][^rdfa-lite] Its goal is to turn any page into an object in a social graph.[^ogp] It is page metadata, not the product markup Google reads for its rich results.

## In a store

A tripod's offer marked up with RDFa Lite and the Schema.org vocabulary. **Fictitious example**: the store, the product, the reference and the price are invented.

```html
<div vocab="https://schema.org/" typeof="Product">
  <h1 property="name">TV-200 travel tripod</h1>
  <p>Reference: <span property="sku">STORE-0457</span></p>
  <div property="offers" typeof="Offer">
    <span>$129.00</span>
    <meta property="price" content="129.00" />
    <meta property="priceCurrency" content="USD" />
    <link property="availability" href="https://schema.org/InStock" />In stock
  </div>
</div>
```

If you have read the entry on [microdata](/glossary/microdata/), the resemblance is obvious. Where microdata uses `itemscope` and `itemtype`, RDFa uses `vocab` once and `typeof` on each element; where microdata uses `itemprop`, RDFa uses `property`.[^rdfa-lite] The product is a [Product](/glossary/product-schema/) and carries its offer inside, an [Offer](/glossary/offer-schema/), declared with `property` and `typeof` at once: that is how types nest in this format. The name and the [SKU](/glossary/sku/) come from the visible text; the price for machines goes in a `meta`, because the visitor sees "$129.00" and the vocabulary asks for the number and the currency separately.

What RDFa does and microdata does not is **mix vocabularies on the same page**: with `prefix` you can declare, for example, Open Graph's in the `html` tag and keep using Schema.org in the body.[^rdfa-lite][^ogp] The cost is the same as with microdata: the markup lives inside the template, and **changing themes can take it out** without anyone deciding to.


That RDFa is an abandoned format that Google no longer reads, and that it has to be removed or redone for that reason alone. Google still names it among the three formats it supports, even though it recommends JSON-LD,[^google-sd-intro] and its Rich Results Test validates it just like the other two.[^rich-results-test] **The problem is not the format, but that it says something different** from what the page says or from what another markup of the same product says.


## How to check it

1. **Open the source code of a [product page](/glossary/product-page/) and search for `vocab=` and `typeof=`.** If they appear in the body of the page, your theme or an app writes structured data in RDFa.[^rdfa-lite]
2. **Set aside what is Open Graph.** The `meta` tags with `property="og:` in the head are Open Graph metadata, not product markup.[^ogp]
3. **Run the URL through the Rich Results Test.** It reads all three formats, tells you what it detects and with what errors, and also accepts a pasted code snippet.[^rich-results-test]
4. **If the page carries RDFa and JSON-LD at the same time, compare them**: the same name, the same price, the same availability.
5. **If you are going to redo the markup, decide the format once.** Google recommends JSON-LD because it is the easiest to maintain when you have many pages.[^google-sd-intro]

## Related concept: microdata

[Microdata](/glossary/microdata/) and RDFa are cousins: Google describes the first as a way of nesting structured data inside HTML content, and the second as attributes on the tags that correspond to visible content.[^google-sd-intro] The practical difference is one of scope. RDFa is a W3C specification meant for any markup language, not just HTML,[^rdfa-core] and **with `prefix` it supports several vocabularies at once** on the same page.[^rdfa-lite] For a [product page](/glossary/product-page/) with Schema.org, the two say the same thing; the useful question is not which is better, but whether the one your store has matches what it shows.

To go further, the [structured data reading path](/learn/structured-data/) orders the rest of the terms, and the [JSON-LD](/glossary/json-ld/) entry explains the format Google recommends.
