b2KIT

RDFa Markup Generator

Create RDFa structured data attributes for HTML elements as an alternative to JSON-LD and Microdata.

Tested tool guide Tested browser tools Checked August 16, 2026

What RDFa Markup Generator does, with a checked example

RDFa encodes structured data as plain HTML attributes: a `vocab` attribute points the page at a vocabulary such as Schema.org, and `typeof` and `property` attributes say what an element is and what its values mean. This generator takes a vocabulary, a type, and a set of properties, and returns ready-to-paste markup you can wrap around content you already have. The thing most people get wrong is placement: nested property attributes describe the nearest enclosing element that declares `typeof`, so moving a snippet onto a different element silently changes the meaning of the whole block.

Worked example

A concrete input and expected output from the current implementation.

Input

Vocabulary: https://schema.org/ | Type: Person | name = Ada Lovelace, email = [email protected]

Expected output

<div vocab="https://schema.org/" typeof="Person">
  <span property="name">Ada Lovelace</span>
  <span property="email">[email protected]</span>
</div>

With `vocab` in scope, the bare tokens Person, name, and email expand against the vocabulary to https://schema.org/Person, https://schema.org/name, and https://schema.org/email. The div's `typeof` opens a new subject, and each `property` generates one triple whose object is the element's text content.

How the result is produced

1

One property, one triple

Each `property` attribute becomes a subject-predicate-object triple. The subject comes from the element's own `about` or `resource`, else from the nearest ancestor that introduced a subject with `typeof`. The predicate is the property token expanded against the vocabulary. The object is the element's text content, unless `content` overrides it, or `href` or `src` turns it into a URI.

2

Vocabularies and prefixes

`vocab` sets a default base for the whole subtree, so a bare token like `Person` resolves to `https://schema.org/Person`. `prefix` declares shorthand mappings such as `foaf: http://xmlns.com/foaf/0.1/` for vocabularies without a default. A token with no colon and no `vocab` in scope is treated as a relative URI reference, which is almost always a mistake.

Good uses

  • Marking up a content page with Schema.org types - Article, Product, Event - when the HTML already exists and you would rather annotate it than add a separate JSON-LD script block.
  • Describing a resource other than the page itself, such as a book or film under review, by putting `about` on a wrapper so title, author, and rating properties all attach to that resource.
  • Adding structured data inside a CMS or template where only body HTML is editable and a `<script type="application/ld+json">` block is stripped, blocked, or inconvenient.

Limits and checks

  • Context outside the snippet wins: the output is correct in isolation, but an ancestor above where you paste it that already declares `typeof`, `about`, or `resource` becomes the subject for any property the snippet does not explicitly scope. Check the page's existing attributes too.
  • A property on an element that also has `href` or `src` yields a URI object, not a text one: `<a property="name" href="https://example.com/jane">Jane</a>` states that the name is that URL, not "Jane". Force an explicit literal with `content` (RDFa Core, not Lite) or move the property off the link.
  • Search-engine expectations: Google Search stopped using RDFa and Microdata for its structured-data features after September 2023, recommending JSON-LD. Generated markup remains valid RDF and valid HTML, but adding it solely for Google rich results will not work.

Common questions

Why would I use RDFa instead of JSON-LD?

RDFa keeps the data inside the markup it describes - no duplicate script block to keep in sync - which suits hand-maintained pages. But JSON-LD is the format Google currently recommends, and RDFa's behavior depends on subtle rules about subject inheritance, so for new projects JSON-LD is usually the lower-effort choice.

What is the difference between `about` and `resource`?

Both give the element's triples a URI subject. `about` is the conventional way to state that the markup describes a particular resource, often the page itself or an external thing, and it usually sits on the body or a wrapper element. `resource` is more often used with `typeof` to give a newly created subject a URI instead of a blank node. When both appear on one element, `about` takes precedence.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools