Patterns

HTML Microdata

Adding Microdata for SEO

HTML microdata uses schema.org to enhance search engine understanding.

Introduction to HTML Microdata

HTML Microdata is a specification that allows you to embed machine-readable data in your web pages using a set of attributes. This data is part of a larger initiative to make the web more semantic and easily understandable by search engines. By using HTML Microdata, you can provide additional context to the content on your web pages, which can improve how search engines interpret and display your page in search results.

How HTML Microdata Works

Microdata works by associating a vocabulary, such as schema.org, with your HTML content. It uses a set of specific attributes: itemscope, itemtype, itemprop, itemid, and itemref. These attributes help define what the data is about and how it relates to other data on the page.

Key Attributes in HTML Microdata

  • itemscope: Defines the scope of the microdata item.
  • itemtype: Specifies the type of item, usually a URL from schema.org.
  • itemprop: Indicates that the element has a specific property. This property name should match a property in the vocabulary.
  • itemid: Provides a global identifier for the item.
  • itemref: Allows you to reference properties from other parts of the document.

Creating a Basic Microdata Example

Let's look at a basic example of how to use HTML microdata to describe a person. We will use schema.org/Person as our vocabulary type.

In this example, we define a Person with properties like name, address, telephone, and email. Each property corresponds to a specific attribute defined in the schema.org vocabulary.

Benefits of Using HTML Microdata

Using HTML Microdata can significantly enhance the visibility and presentation of your content in search engines. Here are some benefits:

  • Improved Search Rankings: Search engines can better understand your content, potentially boosting your rankings.
  • Rich Snippets: Microdata can result in rich snippets on search results pages, making them more attractive to users.
  • Structured Data: Provides a consistent way to describe items and properties, making your data more robust and reusable.