Schema markup is a powerful tool for improving your website's search engine optimisation (SEO) and enhancing the way your content appears in search engine results pages (SERPs). By implementing it, you provide search engines with structured data that helps them better understand and interpret your content, potentially leading to rich snippets, enhanced visibility, and improved click-through rates.
In this essay, I will explain the process of writing schema markup and touch upon real technical examples (HTML) to help explain how it can be implemented.
Understanding schema markup
In short it is a standardised format for providing information about a page and classifying its content. It uses a specific vocabulary of tags (or microdata) that can be added to your HTML to improve how search engines read and represent your page in SERPs. It helps search engines understand the context and meaning of your content, not just the keywords. This can lead to more informative rich snippets in search results, potentially increasing click-through rates and driving more targeted traffic to your site.
So where do you start?
It starts with choosing the right schema type. Schema.org provides a wide variety of schema types, each designed for specific types of content or entities, such as articles, products, events, organisations, and more. Selecting the appropriate schema type ensures that you're providing the most relevant and useful information to search engines about your content.
Review your website content and map out which schema types would be most beneficial. For example, if you have an e-commerce site, you'll likely want to use Product schema for your product pages, while a news site would benefit from Article schema for its content.
Identifying key properties
Each schema type has a set of properties that can be used to describe the entity in more detail. These properties range from basic information like name and description to more specific details depending on the schema type. Including relevant properties provides search engines with comprehensive information about your content, increasing the likelihood of rich snippets and enhanced search results. For each schema type you plan to use,
Review the available properties and identify which ones are most relevant and valuable for your content.
Focus on properties that provide clear, useful information to potential visitors.
Choosing a format for implementation
In general there are three popular formats. JSON-LD, Microdata, and RDFa.
The format you choose affects how you'll integrate the schema markup into your HTML and can impact the ease of implementation and maintenance. JSON-LD is generally recommended as it's easier to implement and maintain, especially for larger websites. It's also the preferred format for Google. Unless you have specific reasons to use other formats, start with JSON-LD.
Writing the Schema Markup
This is the actual process of creating the structured data code that will be added to your web pages. Proper implementation ensures that search engines can correctly interpret your schema markup and use it to enhance your search results.
Start with a basic structure and gradually add more properties. Use Google's Structured Data Testing Tool or Rich Results Test to validate your markup as you go.
Implementing the Schema Markup
This involves adding the completed schema markup to your web pages.
Correct implementation ensures that search engines can find and interpret your schema markup.
For JSON-LD, the schema markup should be placed within a <script> tag in the <head> section of your HTML. For larger websites, consider using a content management system (CMS) plugin or custom development to automate the process of adding schema to your pages.
Testing your schema markup
Google's Rich Results Test:
This is the primary tool for testing your schema markup.
Go to https://search.google.com/test/rich-results
Enter your URL or paste your code snippet
The tool will analyse your markup and show any errors or warnings
It gives you a clear indication of whether your markup is valid and eligible for rich results in Google Search.
Schema Markup Validator (Schema.org):
This tool validates your schema against the Schema.org standards.
Visit https://validator.schema.org/
Enter your URL or paste your code
The tool will check your markup for conformity with Schema.org guidelines
It ensures your markup adheres to the official Schema.org specifications.
Google Search Console:
While not a testing tool per se, it provides valuable insights into how your schema is performing.
Access your Google Search Console account
Navigate to the "Enhancements" section
Check reports for specific schema types (e.g., Products, FAQs, How-tos)
It shows you how your schema markup is performing in real Google search results over time.
Manually Check Search Results:
After implementing schema, manually search for your pages in Google.
Use specific queries that should trigger rich results for your pages
Look for enhanced listings in the search results
It gives you a real-world view of how your schema appears to users in search results.
Some common mistakes to avoid
Using the wrong schema type:
Applying a schema type that doesn't match your content. Carefully review Schema.org types and choose the most appropriate one for your specific content.
Missing required properties:
Omitting properties that are required for a particular schema type. Always check the required properties for each schema type you use and ensure you include them all.
Inconsistent information:
Having schema data that doesn't match the visible content on the page. Ensure your schema accurately reflects the content users can see on your page.
Markup on hidden content:
Applying schema to content that's not visible to users (e.g., in hidden divs).Only apply schema to content that's visible and accessible to users on the page.
Duplicate schema:
Having multiple instances of the same schema type on a single page.Use only one instance of each relevant schema type per page, unless you're intentionally marking up multiple distinct entities.
Improper nesting:
Incorrectly nesting schema types within each other..Understand the hierarchy of schema types and nest them correctly. For example, an 'author' property should be nested within an 'Article' schema, not the other way around.
Ignoring warnings:
Focusing only on errors and ignoring warnings in testing tools.Address both errors and warnings. Warnings can often lead to suboptimal performance of your schema.
Not updating schema:
Implementing schema once and never revisiting it.Regularly review and update your schema, especially when you make changes to your website content or structure.
Overuse of schema:
Trying to markup every single element on a page.Focus on the most important and relevant information. Quality over quantity is key with schema markup.
Incorrect data formats:
Using incorrect formats for properties like dates, times, or durations.Always use the specified formats for each property type. For example, use ISO 8601 format for dates and times.
Schema markup is not a "set it and forget it" task – it requires ongoing attention and maintenance to continue providing value to your SEO efforts.
Some practical examples on how to write Schema
Product Pages
Schema Type: Product
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "Wireless Noise-Cancelling Headphones",
"image": "https://example.com/headphones-image.jpg",
"description": "High-quality wireless headphones with advanced noise-cancelling technology.",
"brand": {
"@type": "Brand",
"name": "AudioTech"
},
"sku": "HDPH-001",
"offers": {
"@type": "Offer",
"url": "https://example.com/headphones",
"priceCurrency": "USD",
"price": "299.99",
"availability": "https://schema.org/InStock",
"seller": {
"@type": "Organisation",
"name": "ElectronicsStore"
}
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.5",
"reviewCount": "89"
}
}
</script>
Blog Posts
Schema Type: BlogPosting
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://example.com/blog/seo-tips"
},
"headline": "10 Essential SEO Tips for 2023",
"image": "https://example.com/images/seo-tips.jpg",
"author": {
"@type": "Person",
"name": "Jane Smith"
},
"publisher": {
"@type": "Organization",
"name": "SEO Experts Blog",
"logo": {
"@type": "ImageObject",
"url": "https://example.com/logo.png"
}
},
"datePublished": "2023-07-09T08:00:00+08:00",
"dateModified": "2023-07-10T09:30:00+08:00",
"description": "Learn 10 essential SEO tips to improve your website's search engine rankings in 2023."
}
</script>
Recipe Pages
Schema Type: Recipe
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Recipe",
"name": "Chocolate Chip Cookies",
"image": "https://example.com/chocolate-chip-cookies.jpg",
"author": {
"@type": "Person",
"name": "Chef John"
},
"datePublished": "2023-07-09",
"description": "Delicious, chewy chocolate chip cookies that are easy to make.",
"prepTime": "PT15M",
"cookTime": "PT12M",
"totalTime": "PT27M",
"keywords": "chocolate chip cookies, easy cookies",
"recipeYield": "24 cookies",
"recipeIngredient": [
"2 1/4 cups all-purpose flour",
"1 tsp baking soda",
"1 cup butter, softened",
"3/4 cup granulated sugar",
"3/4 cup brown sugar",
"2 large eggs",
"2 cups semi-sweet chocolate chips"
],
"recipeInstructions": [
{
"@type": "HowToStep",
"text": "Preheat oven to 375°F (190°C)."
},
{
"@type": "HowToStep",
"text": "Mix flour and baking soda in a bowl."
},
{
"@type": "HowToStep",
"text": "Cream together butter and sugars. Beat in eggs."
},
{
"@type": "HowToStep",
"text": "Gradually add flour mixture. Stir in chocolate chips."
},
{
"@type": "HowToStep",
"text": "Drop by rounded tablespoons onto ungreased baking sheets."
},
{
"@type": "HowToStep",
"text": "Bake for 9 to 11 minutes or until golden brown."
}
],
"nutrition": {
"@type": "NutritionInformation",
"calories": "150 calories",
"fatContent": "7 g",
"carbohydrateContent": "20 g",
"proteinContent": "2 g"
}
}
</script>
Event Pages
Schema Type: Event
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Event",
"name": "Annual Tech Conference 2023",
"startDate": "2023-09-15T09:00",
"endDate": "2023-09-17T18:00",
"location": {
"@type": "Place",
"name": "Tech Convention Center",
"address": {
"@type": "PostalAddress",
"streetAddress": "123 Innovation Boulevard",
"addressLocality": "Silicon Valley",
"addressRegion": "CA",
"postalCode": "94043",
"addressCountry": "US"
}
},
"image": "https://example.com/tech-conference-2023.jpg",
"description": "Join us for the biggest tech conference of the year, featuring industry leaders and innovative workshops.",
"offers": {
"@type": "Offer",
"url": "https://example.com/ticket-sales",
"price": "399",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"validFrom": "2023-05-01T00:00"
},
"organizer": {
"@type": "Organization",
"name": "Tech Events Inc.",
"url": "https://techeventsinc.com"
}
}
</script>
FAQ Pages
Schema Type: FAQPage
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [{
"@type": "Question",
"name": "What is schema markup?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Schema markup is a code that you put on your website to help search engines return more informative results for users. It's a form of microdata that creates an enhanced description (commonly known as a rich snippet)."
}
}, {
"@type": "Question",
"name": "How does schema markup help SEO?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Schema markup helps search engines understand your content better, which can lead to rich snippets in search results. This can improve click-through rates and drive more targeted traffic to your site."
}
}]
}
</script>
About Me:
I write to learn. More about me here. Follow @ hackrlife on X