Structured Data and Schema.org
Structured data is a standardized format for providing explicit information about a page's content to search engines. While search engines are remarkably good at understanding natural language, they still rely on educated guesses when interpreting web content. Structured data removes that ambiguity by telling search engines exactly what your content represents — whether it is an article, a product, a recipe, an event, a FAQ, or any of hundreds of other types defined in the Schema.org vocabulary.
The practical benefit of structured data is significant: pages with properly implemented structured data can qualify for rich results (also called rich snippets) in Google Search. These enhanced search results include additional visual elements like star ratings, images, FAQ dropdowns, breadcrumb trails, and event dates that make your listing stand out from standard blue-link results and dramatically improve click-through rates.
What Structured Data Is and Why It Matters
At its core, structured data is metadata that describes the entities on your page and the relationships between them. Consider a page about a recipe. Without structured data, a search engine sees text, headings, and images. It can probably figure out that the page is about cooking, but it has to guess at the cooking time, calorie count, rating, and ingredient list. With structured data, you explicitly declare all of these properties in a machine-readable format.
Structured data enables several types of enhanced search features:
- Rich snippets: Enhanced search results that display additional information such as ratings, prices, availability, cooking times, or calorie counts directly in the search results page.
- Knowledge panels: The information boxes that appear on the right side of Google search results for organizations, people, and other well-known entities. Structured data helps Google populate these panels with accurate information about your organization.
- FAQ rich results: Expandable question-and-answer sections that appear directly in search results, giving your page significantly more visual real estate.
- Breadcrumb trails: Instead of showing the raw URL, Google can display a breadcrumb path (e.g., "Quality Engineering Guide > SEO > Structured Data") that helps users understand the page's position in your site hierarchy.
- Carousels and lists: For certain content types like recipes, courses, and events, Google may display your content in a scrollable carousel format.
JSON-LD: Google's Recommended Format
There are three formats for implementing structured data: JSON-LD (JavaScript Object Notation for Linked Data), Microdata, and RDFa. Google explicitly recommends JSON-LD as the preferred format, and for good reason.
JSON-LD is implemented as a <script> block in the page's <head> section (or anywhere in the document body). Unlike Microdata and RDFa, which require you to add attributes directly to HTML elements throughout your page, JSON-LD keeps the structured data separate from the presentation markup. This separation has several advantages:
- Easier to implement: You add a single script block rather than modifying dozens of HTML elements throughout the page.
- Easier to maintain: Structured data is in one place, making it easy to review, update, and debug.
- Easier to generate dynamically: Server-side languages like PHP can build the JSON-LD object programmatically and output it as a single block, as we do on the CodeFrog website.
- No impact on HTML structure: JSON-LD does not add attributes to your HTML elements, so it cannot break your CSS or JavaScript.
- Easier to test: You can validate the JSON-LD block independently of the rest of the page.
A basic JSON-LD block looks like this:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "Structured Data and Schema.org",
"description": "Learn about structured data...",
"author": {
"@type": "Organization",
"name": "GreenRobot LLC"
}
}
</script>
The @context property tells parsers which vocabulary to use (always https://schema.org for web SEO). The @type property declares what kind of entity is being described. All other properties are specific to the chosen type.
Common Schema.org Types
Schema.org defines hundreds of types, but a relatively small number are most commonly used for web SEO. Here are the types you will encounter and implement most frequently:
Article
Used for news articles, blog posts, and editorial content. Key properties include headline, description, author, publisher, datePublished, dateModified, and image. This is one of the most widely used schema types.
FAQPage
Used for pages that contain a list of frequently asked questions and their answers. When properly implemented, FAQPage structured data can generate expandable FAQ sections directly in search results, providing significant additional visibility. Each question is represented as a Question entity with an acceptedAnswer property.
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What is structured data?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Structured data is a standardized format..."
}
}
]
}
HowTo
Used for instructional content that guides users through a sequence of steps to achieve a result. HowTo markup can generate step-by-step rich results in Google Search. Key properties include name, step (an array of HowToStep entities), totalTime, and estimatedCost.
Product
Used for e-commerce product pages. Enables rich results showing price, availability, ratings, and review counts. Key properties include name, description, image, offers (containing price and availability), and aggregateRating.
BreadcrumbList
Defines the breadcrumb navigation path for a page. When implemented, Google replaces the raw URL in search results with a formatted breadcrumb trail, making the result more informative and visually appealing. Each breadcrumb is a ListItem with a position, name, and item (URL).
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Quality Engineering Guide",
"item": "https://codefrog.app/quality-engineering/"
},
{
"@type": "ListItem",
"position": 2,
"name": "SEO",
"item": "https://codefrog.app/quality-engineering/seo/"
}
]
}
Organization
Provides information about your organization, including name, logo, URL, contact information, and social media profiles. Organization markup helps Google build a knowledge panel for your brand and associate your content with your organization.
LocalBusiness
A more specific type of Organization, used for businesses with physical locations. Includes properties for address, opening hours, phone number, geographic coordinates, and accepted payment methods. Critical for local SEO and Google Maps integration.
The Schema.org Vocabulary
Schema.org is a collaborative project founded by Google, Microsoft, Yahoo, and Yandex in 2011. It provides a shared vocabulary for structured data markup that all major search engines understand. The vocabulary is organized as a hierarchy of types, with Thing at the top level branching into categories like CreativeWork, Event, Organization, Person, Place, and Product.
Each type has a defined set of properties. Types inherit properties from their parent types, so an Article (which extends CreativeWork which extends Thing) has access to all properties defined on Thing (like name, description, url) plus all properties specific to CreativeWork (like author, publisher, datePublished) plus its own properties (like articleBody, wordCount).
You do not need to include every possible property. Focus on the properties that Google documents as required or recommended for each type's rich result feature. Including accurate, complete information for the recommended properties maximizes your chances of earning rich results.
Testing with Google Rich Results Test
Google provides the Rich Results Test tool to validate your structured data implementation. This tool fetches a URL (or accepts a code snippet), parses the structured data, reports any errors or warnings, and shows a preview of how the rich result might appear in search.
Key testing practices:
- Test every template: If your site uses templates (e.g., article template, product template, FAQ template), test at least one page of each template type to ensure the structured data is correctly generated for each.
- Check for errors vs warnings: Errors prevent rich results from appearing. Warnings indicate missing recommended (but not required) properties that could improve your results.
- Test after changes: Whenever you modify structured data, re-test the affected pages. A small syntax error can invalidate the entire block.
- Use Search Console: Google Search Console provides an ongoing report of structured data issues detected across your entire site, not just individual pages. Check the "Enhancements" section for schema-specific reports.
How the CodeFrog Website Uses JSON-LD
The CodeFrog website itself is a practical example of JSON-LD structured data implementation. Every page on the site includes structured data in JSON-LD format, generated dynamically using PHP. The topic index pages use the Course type with hasPart properties listing each lesson. Individual lesson pages use the Article type with isPartOf linking back to their parent course. This approach provides search engines with a complete picture of the content hierarchy and relationships.
The structured data is generated server-side using PHP arrays that are converted to JSON with json_encode(). This approach is clean, maintainable, and ensures that the structured data always matches the actual page content because both are generated from the same data source. The script block includes a nonce attribute for Content Security Policy compliance, demonstrating how structured data implementation intersects with security best practices.
Resources
- Schema.org — The complete vocabulary of structured data types and properties
- Google Rich Results Test — Tool to validate and preview your structured data implementation
- Google Structured Data Documentation — Google's guide to implementing structured data for rich results