Microdata and Structured Data (Schema.org)
Answer
Structured data is a standardized format for providing information about a page and classifying content. It helps search engines understand your content and display rich results (rich snippets).
Structured Data Formats
JSON-LD (Recommended)
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "Understanding Structured Data",
"author": {
"@type": "Person",
"name": "John Doe",
"url": "https://example.com/author/johndoe"
},
"publisher": {
"@type": "Organization",
"name": "Tech Blog",
"logo": {
"@type": "ImageObject",
"url": "https://example.com/logo.png"
}
},
"datePublished": "2024-01-15",
"dateModified": "2024-01-20",
"image": "https://example.com/article-image.jpg",
"description": "Learn how to implement structured data in your HTML"
}
</script>
Microdata Format
<article itemscope itemtype="https://schema.org/Article">
<h1 itemprop="headline">Understanding Structured Data</h1>
<div itemprop="author" itemscope itemtype="https://schema.org/Person">
By <span itemprop="name">John Doe</span>
</div>
<time itemprop="datePublished" datetime="2024-01-15"> January 15, 2024 </time>
<img itemprop="image" src="article-image.jpg" alt="Article Image" />
<div itemprop="articleBody">
<p>Article content here...</p>
</div>
</article>
Common Schema Types
Product
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Executive Leather Chair",
"image": "https://example.com/chair.jpg",
"description": "Premium office chair with lumbar support",
"brand": {
"@type": "Brand",
"name": "OfficePro"
},
"offers": {
"@type": "Offer",
"price": "299.99",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"seller": {
"@type": "Organization",
"name": "Furniture Store"
}
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.5",
"reviewCount": "89"
}
}
</script>
Local Business
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Restaurant",
"name": "The Great Bistro",
"image": "https://example.com/bistro.jpg",
"address": {
"@type": "PostalAddress",
"streetAddress": "123 Main Street",
"addressLocality": "New York",
"addressRegion": "NY",
"postalCode": "10001"
},
"telephone": "+1-555-123-4567",
"openingHoursSpecification": [
{
"@type": "OpeningHoursSpecification",
"dayOfWeek": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
"opens": "11:00",
"closes": "22:00"
}
],
"servesCuisine": "Italian",
"priceRange": "$$"
}
</script>
FAQ Page
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What is structured data?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Structured data is a standardized format for providing information about a page..."
}
},
{
"@type": "Question",
"name": "Why is it important for SEO?",
"acceptedAnswer": {
"@type": "Answer",
"text": "It helps search engines understand content and enables rich results..."
}
}
]
}
</script>
Breadcrumbs
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://example.com"
},
{
"@type": "ListItem",
"position": 2,
"name": "Products",
"item": "https://example.com/products"
},
{
"@type": "ListItem",
"position": 3,
"name": "Office Chairs",
"item": "https://example.com/products/chairs"
}
]
}
</script>
Rich Results
| Schema Type | Rich Result |
|---|---|
| Article | News carousel, Top stories |
| Product | Price, rating, availability |
| Recipe | Image, rating, cook time |
| Event | Date, location, tickets |
| FAQ | Expandable Q&A in search |
| How-to | Step-by-step instructions |
| Review | Star ratings |
Testing Tools
- Google Rich Results Test: https://search.google.com/test/rich-results
- Schema Markup Validator: https://validator.schema.org/
- Google Search Console: Monitor rich results performance
Best Practices
<!-- ✅ Do: Use JSON-LD format -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "My Site"
}
</script>
<!-- ✅ Do: Include required properties -->
<!-- ❌ Don't: Add markup for content not visible on page -->
<!-- ❌ Don't: Use mark up to deceive or mislead -->
Key Points
- JSON-LD is the recommended format
- Structured data enables rich search results
- Test with Google's Rich Results Test
- Only mark up visible content
- Schema.org is the vocabulary standard
- Improves CTR from search results