Lesson 41 of 55 · HTML
Microdata & Structured Data – Schema.org
Duration: 10 min
Structured Data with Microdata
Microdata lets you embed machine‑readable data directly in HTML using itemscope, itemtype, and itemprop.
<div itemscope itemtype='https://schema.org/Person'>
<h1 itemprop='name'>Jane Doe</h1>
<p>Web developer based in <span itemprop='address'>Seattle</span>.</p>
<a href='mailto:jane@example.com' itemprop='email'>jane@example.com</a>
</div>
Key attributes
itemscope– Declares a new entity (the start of a microdata block).itemtype– URL pointing to a Schema.org type (e.g.,Person,Article,Product).itemprop– Property name of the entity; the text/value of the element becomes the property's value.
JSON‑LD alternative (recommended)
<script type='application/ld+json'>
{
"@context": "https://schema.org",
"@type": "Person",
"name": "Jane Doe",
"url": "https://example.com",
"email": "mailto:jane@example.com",
"address": {
"@type": "PostalAddress",
"addressLocality": "Seattle",
"addressRegion": "WA"
}
}
</script>
JSON‑LD keeps your markup clean and is easier to maintain.
Validation
- Use Google’s Rich Results Test or Schema Markup Validator to verify that search engines can read your markup.
- Check the Structured Data Testing Tool (now part of Search Console) for warnings.
Quick checklist for structured data
itemscopeanditemtypeused where appropriate? ✅itempropnames follow Schema.org vocabulary? ✅- JSON‑LD added for complex entities? ✅
- Validation passed in Google Rich Results Test? ✅
- No duplicate
@typedefinitions that could confuse parsers? ✅
Tip: Start with JSON‑LD for most use‑cases, and fall back to Microdata only when you need inline markup for a legacy CMS.