RDFa: How It Works, Syntax & When to Use It

RDFa (Resource Description Framework in Attributes) is a W3C Recommendation that embeds RDF data directly in HTML, XHTML, and XML documents using a small set of attributes. Instead of adding a separate data block, RDFa annotates the markup that already displays the content, so the visible text and the machine-readable statement are the same string. RDFa 1.1 and its simplified profile RDFa Lite 1.1 both reached second-edition Recommendation status in 2015.

RDFa matters beyond its own usage numbers: the Open Graph protocol is defined as an RDFa vocabulary, so every og:title tag on the web is an RDFa-derived RDF predicate.

Two specifications: RDFa 1.1 and RDFa Lite

RDFa 1.1 Core is the full specification. Its dozen attributes cover prefix mappings, typed literals, language tags, reverse relationships, and ordered lists, enough to serialize almost any RDF graph inside a document.

RDFa Lite 1.1 is a subset published as a separate Recommendation on the same day. It defines five attributes and nothing else, on the reasoning that most publishers want to mark up a product or an organization rather than encode arbitrary RDF. It is deliberately close in shape to Microdata, and any RDFa Lite document is also valid RDFa 1.1. In practice, close to all RDFa on the public web is RDFa Lite plus the occasional content attribute.

The RDFa Lite attribute set

Five attributes carry the work.

vocab sets the default vocabulary for the element and everything inside it, so bare property names resolve against it.

<div vocab="https://schema.org/">…</div>

typeof declares the RDF type of the subject and, when no resource or about is given, creates a new subject node.

<div vocab="https://schema.org/" typeof="Organization">…</div>

property names the predicate. The object is the element’s text content unless an attribute such as content, href, or src overrides it.

<span property="name">University of Florida</span>

resource gives the subject an explicit IRI instead of a blank node, so other documents can refer to the same thing.

<div typeof="Organization" resource="https://www.ufl.edu/#org">…</div>

prefix declares additional vocabulary prefixes, which is what lets one document mix vocabularies.

<div prefix="dc: http://purl.org/dc/terms/ foaf: http://xmlns.com/foaf/0.1/">…</div>

The fuller RDFa 1.1 attributes

The Core specification adds eight more attributes, used mainly by publishers with an existing RDF model to express.

  • about sets the subject for an element and its children without declaring a type, which is how a document states facts about something other than itself.
  • rel and rev express relationships to other resources; rev reverses the direction, so rev="creator" on a link from a book to an author states that the author created the book.
  • href and src supply the object of a rel or property when that object is a resource rather than a literal.
  • content supplies a machine-readable literal that differs from the displayed text, usually a date or a number.
  • datatype types a literal (datatype="xsd:date"); an empty datatype="" forces a plain literal.
  • inlist collects objects of the same predicate into an ordered RDF list.

A worked example

The following block marks up a visible organization card in RDFa Lite. Nothing is duplicated: every value is text a reader sees.

<div vocab="https://schema.org/" typeof="Organization"
     resource="https://www.ufl.edu/#organization">
  <h1 property="name">University of Florida</h1>
  <img property="logo" src="https://www.ufl.edu/logo.png" alt="UF logo">
  <p property="description">A public land-grant research university in
     Gainesville, Florida.</p>
  <div property="address" typeof="PostalAddress">
    <span property="streetAddress">1523 Union Road</span>,
    <span property="addressLocality">Gainesville</span>,
    <span property="addressRegion">FL</span>
    <span property="postalCode">32611</span>
  </div>
  <a property="sameAs" href="https://www.wikidata.org/wiki/Q505306">Wikidata</a>
  <meta property="foundingDate" content="1853-01-06">
</div>

Extracted, that markup produces the following triples, shown here in Turtle.

@prefix schema: <https://schema.org/> .

<https://www.ufl.edu/#organization>
    a schema:Organization ;
    schema:name "University of Florida" ;
    schema:logo <https://www.ufl.edu/logo.png> ;
    schema:description "A public land-grant research university in Gainesville, Florida." ;
    schema:sameAs <https://www.wikidata.org/wiki/Q505306> ;
    schema:foundingDate "1853-01-06" ;
    schema:address [
        a schema:PostalAddress ;
        schema:streetAddress "1523 Union Road" ;
        schema:addressLocality "Gainesville" ;
        schema:addressRegion "FL" ;
        schema:postalCode "32611"
    ] .

Three mechanisms are visible. logo and sameAs produce resource objects rather than literals because the values came from src and href. foundingDate comes from a content attribute on an empty meta element, since no reader needs to see an ISO date. And address produces a blank node, written [ … ] in Turtle, because the nested element declared a typeof without a resource.

Chaining and nested typeof

The address block above is an example of chaining. When an element carries both property and typeof, RDFa creates a new node, makes it the object of the outer predicate, and makes it the subject for everything nested inside. That single rule allows arbitrarily deep structures (an Article whose author is a Person whose affiliation is an Organization) without repeating identifiers. rel chains the same way for resource-valued relationships. Giving the inner element a resource IRI rather than leaving it a blank node is usually worth the extra characters, because a named node can be merged with data from other pages.

Mixing vocabularies

RDFa’s real advantage over Microdata is that prefixes and vocabularies are first-class. A library catalogue page can describe a book with schema.org for search engines, Dublin Core for repository harvesters, and FOAF for the author, in one element tree.

<article prefix="dc: http://purl.org/dc/terms/ bibo: http://purl.org/ontology/bibo/"
         vocab="https://schema.org/" typeof="Book bibo:Book"
         resource="https://example.edu/books/9780262527910">
  <h1 property="name dc:title">Knowledge Graphs</h1>
  <span property="dc:publisher">MIT Press</span>
  <span property="isbn dc:identifier">9780262527910</span>
</article>

Two things are impossible in idiomatic Microdata: one element carrying two types from different vocabularies, and one property value listing two predicates so a single visible string yields two triples.

RDFa vs Microdata

Both embed data in the visible markup, and both produce the same kind of triples. The differences are practical.

RDFa LiteMicrodata
Standards bodyW3C Recommendation (2015 second edition)WHATWG living standard
Attributesvocab, typeof, property, resource, prefixitemscope, itemtype, itemprop, itemid, itemref
VocabularyAny, via vocab and prefixImplied by the itemtype URL
Multiple vocabularies per elementYesNot idiomatic
Non-nested itemsNot supporteditemref
Document typesHTML, XHTML, XML, SVGHTML only

RDFa vs JSON-LD

JSON-LD puts the same triples in a <script type="application/ld+json"> block, separate from the markup. Google parses RDFa, Microdata, and JSON-LD for rich results, while recommending JSON-LD.

That recommendation is about maintenance, not semantics. A JSON-LD block is one contiguous object that a template, a CMS plugin, or a tag manager can generate and validate in isolation. RDFa is spread across the markup, so a component refactor or a translation pass can silently drop a triple. RDFa’s compensating advantage is that the data cannot drift out of sync with the visible text, because it is the visible text. The full comparison is in JSON-LD vs Microdata vs RDFa.

Where RDFa still appears

Open Graph. The Open Graph protocol is defined as an RDFa vocabulary, and its meta tags are RDFa property values. This is RDFa’s largest deployment by far, though almost nobody using it thinks of it as RDFa.

Drupal. Drupal core has emitted RDFa in its default templates since Drupal 7, which put RDFa on many government, university, and nonprofit sites by default.

Publishing and library metadata. Dublin Core, BIBFRAME, and PRISM-style vocabularies predate schema.org, and RDFa is the only in-HTML syntax that carries them alongside schema.org without duplication.

European and government portals. DCAT-AP, the EU’s data catalog profile, and several national statistics and legislation portals publish RDFa in their HTML views.

For developers

Parse RDFa with a library rather than a regular expression. rdflib in Python, reads RDFa through pyRdfa; Apache Any23 covers Java and is useful for confirming what a page actually yields, since it reports RDFa, Microdata, and JSON-LD from the same fetch.

The failure to plan for is templating. Put the RDFa attributes inside the component that renders the values, not in the page that calls it, and add a build-time test that extracts triples from a rendered page and asserts the expected subjects and predicates.

For SEO

RDFa is a valid way to give Google structured data, with no ranking penalty. On a site that already emits correct RDFa, migrating to JSON-LD isn’t a priority; on a new build, choose JSON-LD because it is easier to generate, easier to review, and the format Google’s own documentation uses in every example.

Never run both for the same entity unless the values are identical. Declaring one Organization in both RDFa and JSON-LD with different names or logos gives search engines two conflicting statements about the same subject. See organization schema and structured data testing tools.

Common mistakes

Forgetting vocab. Without vocab or a prefix, property="name" is not a valid IRI and produces no triple.

Using property for a link target. property="url" on an <a> takes the anchor text literally. Use href, or use rel.

Leaving everything a blank node. Omitting resource and about throughout means nothing on the page can be referenced from elsewhere.

Dates as display text. property="datePublished" around “September 8, 2026” yields a string, not a date. Add content="2026-09-08".

Wrapping the wrong element. An attribute on a parent that also holds navigation or a byline sweeps that text into the literal.

How to test it

Run the page through Google’s Rich Results Test and the Schema Markup Validator at validator.schema.org, which reports all schema.org markup regardless of syntax. For raw triples rather than an SEO verdict, use Apache Any23 and read the Turtle output. Test a rendered production page whose content came from the CMS, not a hand-built sample.

Related pages

FAQ

What is RDFa?

RDFa is a W3C Recommendation for embedding RDF data in HTML using attributes such as vocab, typeof, and property. It annotates the markup that already displays the content, so one string serves both readers and machines. RDFa 1.1 is the full specification, and RDFa Lite 1.1 is a five-attribute subset that covers most publishing needs.

What is the difference between RDFa and RDFa Lite?

RDFa Lite defines five attributes: vocab, typeof, property, resource, and prefix. RDFa 1.1 Core adds about, rel, rev, src, href, content, datatype, and inlist, which allow reverse relationships, typed literals, and ordered lists. Every RDFa Lite document is valid RDFa 1.1, so starting with Lite costs nothing.

Is RDFa or JSON-LD better for SEO?

Google parses both, and neither ranks better. JSON-LD is recommended because a single script block is easier to generate from a template and easier to validate than attributes spread across the markup. RDFa’s advantage is that its values are the visible text, so they cannot drift out of sync with what the page displays.

Does Google still support RDFa?

Yes. Google Search Central lists RDFa alongside Microdata and JSON-LD as supported structured data formats, and it generates rich results from RDFa markup. Google recommends JSON-LD for new implementations but does not treat RDFa as deprecated or penalize its use.

Sources and further reading

  • RDFa 1.1 Primer (W3C): https://www.w3.org/TR/rdfa-primer/
  • RDFa Core 1.1, Third Edition (W3C Recommendation): https://www.w3.org/TR/rdfa-core/
  • RDFa Lite 1.1, Second Edition (W3C Recommendation): https://www.w3.org/TR/rdfa-lite/
  • Google Search Central, “Introduction to structured data markup”: https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data
  • Schema Markup Validator: https://validator.schema.org/
  • The Open Graph protocol: https://ogp.me/