9.1 What is Microdata?
Microdata (structured data) is a way to add metadata to HTML documents to better interpret the content of webpages by search engines and other services. It's used to describe different entities and their relationships on a webpage, which helps improve page visibility in search results and offers extra features like rich snippets.
Microdata are structured data added to the HTML code of a page. It provides search engines with extra info about the page content, like content type, author, publication date, rating, and other data.
Main types of Microdata:
- Schema.org: the most widely used microdata standard, supported by major search engines (Google, Bing, Yahoo, Yandex)
- JSON-LD: a JSON format for encoding microdata, recommended by Google
- Microdata: a microdata format embedded directly in HTML code
9.2 Schema.org
Schema.org is a vocabulary of data types and their properties developed for structuring data on web pages. It supports a bunch of data types, like articles, events, organizations, products, and so on.
Examples of using Schema.org
Article:
<article>
<h1>Article Title</h1>
<p>Author: Author Name</p>
<p>Publication Date: January 1, 2024</p>
<img src="https://example.com/image.jpg" alt="Example Image">
<p>Article text...</p>
</article>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "Article Title",
"author": {
"@type": "Person",
"name": "Author Name"
},
"datePublished": "2024-01-01",
"image": "https://example.com/image.jpg",
"publisher": {
"@type": "Organization",
"name": "Publisher",
"logo": {
"@type": "ImageObject",
"url": "https://example.com/logo.png"
}
}
}
</script>
Product:
<body>
<h1>Product Name</h1>
<img src="https://example.com/product.jpg" alt="Product Image">
<p>Product Description</p>
<p>Price: $29.99</p>
</body>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Product Name",
"image": "https://example.com/product.jpg",
"description": "Product Description",
"sku": "0446310786",
"offers": {
"@type": "Offer",
"priceCurrency": "USD",
"price": "29.99",
"itemCondition": "https://schema.org/NewCondition",
"availability": "https://schema.org/InStock",
"url": "https://example.com/product"
}
}
</script>
Benefits of using Schema.org:
- Improved visibility: search engines can display additional data in search results (rich snippets).
- Better interpretation: search engines understand content better, potentially improving page ranking.
- Standard support: Schema.org is supported by all major search engines.
9.3 JSON-LD
JSON-LD (JavaScript Object Notation for Linked Data) is a method for encoding microdata in JSON format, inserted into a
<script>
tag on the page. Google recommends using JSON-LD for structured data.
Example of using JSON-LD
Organization:
<body>
<h1>Company Name</h1>
<p>Company Description</p>
<div>Contacts</div>
</body>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "Company Name",
"url": "https://example.com",
"logo": "https://example.com/logo.png",
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+1-800-555-1212",
"contactType": "Customer Service"
}
}
</script>
9.4 Microdata
Microdata is a microdata format embedded in HTML. microdata
attributes are added directly to HTML elements to associate them with types and properties from the Schema.org vocabulary.
Example of using Microdata
Event:
<body itemscope itemtype="https://schema.org/Event">
<h1 itemprop="name">Event Name</h1>
<p itemprop="startDate" content="2024-05-01T19:00">May 1, 2024, 7:00 PM</p>
<div itemprop="location" itemscope itemtype="https://schema.org/Place">
<span itemprop="name">Venue</span>
<div itemprop="address" itemscope itemtype="https://schema.org/PostalAddress">
<span itemprop="streetAddress">Street, Building</span>
<span itemprop="addressLocality">City</span>
<span itemprop="postalCode">Postal Code</span>
<span itemprop="addressCountry">Country</span>
</div>
</div>
</body>
Benefits of using microdata:
- Rich snippets: search engines can display enhanced snippets in search results, increasing click-through rates.
- Better content understanding: search engines understand content better, which might improve page ranking.
- Support for voice search: structured data can improve voice search results.
- Integration with other services: microdata enables content integration with various services like Google Knowledge Graph and others.
GO TO FULL VERSION