Section 33: Microdata, Structured Data and JSON-LD
Learning Objectives
- Understand structured data and its purpose.
- Learn the basics of Microdata attributes.
- Add JSON-LD structured data to an HTML page.
- Understand the relationship between structured data and SEO.
1. What Is Structured Data?
Structured data describes information in a format that software can interpret. A page about a course, for example, can identify its name, description, provider and other relevant properties in a consistent format.
Structured data may help search engines understand page content and can make a page eligible for certain enhanced search appearances. It does not guarantee higher rankings or a rich result.
2. What Is Microdata?
Microdata uses HTML attributes to identify an item's type and properties.
<article itemscope itemtype="https://schema.org/Course">
<h1 itemprop="name">HTML Mastery</h1>
<p itemprop="description">
Learn HTML through practical examples and projects.
</p>
<p>Provider:
<span itemprop="provider"
itemscope
itemtype="https://schema.org/Organization">
<span itemprop="name">Codementrix</span>
</span>
</p>
</article>
- itemscope: identifies an item.
- itemtype: identifies the vocabulary type.
- itemprop: identifies a property of the item.
3. What Is JSON-LD?
JSON-LD stands for JavaScript Object Notation for Linked Data. It describes structured information in a JSON format and is commonly added to an HTML page inside a script element.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "Codementrix",
"url": "https://example.com",
"description": "Web development tutorials and software services."
}
</script>
Replace the example URL and description with accurate information about the actual organization. Do not publish fabricated business details.
4. Article Structured Data
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "HTML Forms Tutorial for Beginners",
"description": "Learn HTML forms, controls and validation.",
"author": {
"@type": "Person",
"name": "Article Author"
},
"publisher": {
"@type": "Organization",
"name": "Codementrix"
},
"mainEntityOfPage": "https://example.com/blog/html-forms"
}
</script>
This is an illustrative example. Use real authorship, accurate URLs and properties that match the page. Follow the relevant search engine documentation for eligibility requirements.
5. Structured Data Must Match the Page
- Describe content that actually exists on the page.
- Use valid schema types and property names.
- Do not add misleading ratings, prices, authors or dates.
- Check the syntax and applicable search engine guidelines.
- Keep visible content and structured data consistent.
6. Microdata vs JSON-LD
| Microdata | JSON-LD |
|---|---|
| Structured data attributes are placed on HTML elements. | Structured data is commonly placed in a JSON-LD script element. |
| Properties are associated directly with markup. | Data is maintained in a separate structured block. |
| Can become harder to manage in complex templates. | Often easier to generate from application data. |
7. Validation Tools
Use the Schema.org Validator to inspect structured data vocabulary and syntax. Use Google's Rich Results Test to check eligibility for supported Google rich results. A valid schema document is not automatically eligible for every enhanced search appearance.
Common Mistakes
- Using incorrect JSON syntax, such as trailing commas.
- Adding structured data that does not match the visible page.
- Assuming structured data guarantees a rich result.
- Copying placeholder author names or URLs into a live website.
- Using unsupported properties for a particular search feature.
Practice Exercises
- Add Microdata to a sample course description.
- Write JSON-LD for an organization using accurate sample data.
- Create an Article structured data example for a tutorial.
- Explain the difference between Microdata and JSON-LD.
Revision Quiz
- What is structured data?
- Which attribute begins a Microdata item?
- Which attribute defines a Microdata vocabulary type?
- Which script type is commonly used for JSON-LD?
- Does valid structured data guarantee a rich result?
- Should structured data contain fabricated ratings or authors?
Answer Key and Explanations
- Machine-readable information about page content — It describes entities and their properties.
- itemscope — It identifies an item.
- itemtype — It specifies the item's vocabulary type.
- application/ld+json — It identifies the JSON-LD data block.
- No. Eligibility depends on supported features and additional requirements.
- No. Structured data must be accurate and not misleading.