BF50 Black Friday · 50% off all plans
from $5/mo · Auto-applied ---:--:-- Claim 50% off →
Skip to content

Search Seonio

Type a keyword, domain, or paste a URL

Start free with $1 to see full results. Powered by Seonio
SEO

Microdata: Structured data inside your HTML

Microdata labels the content visitors see with machine-readable properties, using HTML attributes such as itemscope and itemprop. Google supports it.

Monthly searches · microdata
8.1k
Keyword research data
microdata
Microdata: Structured data inside your HTML
Click the image to view it full size

Microdata is a way to label the content on a web page so that machines can read it, without writing that content twice. You add a few attributes to the HTML you already have, and the text a visitor reads becomes data too: this span is a product name, that one is its price.

It's part of the HTML standard, which describes microdata as groups of name-value pairs added alongside a page's existing content. WHATWG HTML Each group is an item, and each name-value pair is a property.

On most websites, microdata carries the schema.org vocabulary, which search engines read as structured data.

The five attributes

Attribute What it does
itemscope Starts an item: everything inside this element can belong to it. See itemscope
itemtype Says what kind of item it is, as a URL from a vocabulary, such as https://schema.org/Product
itemprop Names a property; the element's content is the value. See itemprop
itemid Gives the item a global identifier, such as a book's ISBN
itemref Adds properties from elsewhere on the page, by their id

An example

Here's a product page marked up with microdata and schema.org:

<div itemscope itemtype="https://schema.org/Product">
  <h1 itemprop="name">Trail Runner 2</h1>
  <img itemprop="image" src="/images/trail-runner-2.jpg" alt="Trail Runner 2 shoe in blue">
  <p itemprop="description">Waterproof trail running shoe with deep grip for mud and wet rock.</p>

  <div itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
    Rated <span itemprop="ratingValue">4.6</span> out of 5
    from <span itemprop="reviewCount">128</span> reviews
  </div>

  <div itemprop="offers" itemscope itemtype="https://schema.org/Offer">
    <meta itemprop="priceCurrency" content="USD">
    $<span itemprop="price">89.00</span>
    <link itemprop="availability" href="https://schema.org/InStock">In stock
  </div>
</div>

A few things to notice:

  • Items nest. The rating and the offer are items of their own, each attached to the product through an itemprop.
  • Most values are the visible text. "Trail Runner 2" is the name because it's the text inside the element.
  • Some elements give their value differently. An img or a gives its src or href, a time element its datetime, and a meta element its content. That's how the currency code USD is supplied next to the visible "$" sign.

Microdata, JSON-LD or RDFa?

Google reads all three formats and says they're equally fine when the markup is valid. It recommends JSON-LD where your setup allows, because it's the easiest to implement and maintain at scale. JSON-LD sits in a separate <script> block, while microdata and RDFa are woven into the visible HTML.

Your situation A good choice
You can add a script block to your templates JSON-LD
Your theme or CMS already outputs microdata, and it validates Keep the microdata
You want the data to change whenever the visible text changes, from the same template Microdata
You're starting fresh with nested or complex data JSON-LD

If a page ends up with two formats, for example microdata from the theme and JSON-LD from a plugin, make sure they describe the same facts with the same values.

Rules that apply to any format

  • Mark up only what visitors can see. Google says not to mark up content that's hidden from readers, and Bing says markup must reflect visible content. Microdata makes this easy, since it sits on the visible text.
  • Valid isn't the same as shown. Correct markup makes a page eligible for rich results, but Google doesn't guarantee them.
  • Test before and after you publish. Use Google's Rich Results Test to see which Google features a page qualifies for, and the Schema Markup Validator at validator.schema.org to check schema.org markup in general. After launch, watch the rich result reports in Search Console, because template changes can break markup.

For an older, class-based way of labeling HTML, see microformats.

Seonio

Put it to work on your own site

Keyword research, traffic, backlinks and clustering in one place. Start with a free $1 to test, no card required.