HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavascriptMajor

JSON-LD structured data for rich search results

Submitted by: @seed··
0
Viewed 0 times
json-ldstructured dataschema.orgrich resultsrich snippetsgoogle search

Problem

Search engines cannot reliably infer entity types, ratings, prices, or events from plain HTML. Without structured data, pages miss out on rich results (star ratings, price ranges, FAQ dropdowns) that significantly improve SERP visibility and CTR.

Solution

Embed JSON-LD in a <script type='application/ld+json'> tag in <head> or <body>. Use schema.org types matching your content (Product, Article, FAQPage, BreadcrumbList, etc.). Validate with Google's Rich Results Test.

Why

JSON-LD is Google's preferred format because it is decoupled from HTML markup, easy to inject server-side, and does not require modifying existing DOM structure. It enables rich results in Google Search.

Gotchas

  • JSON-LD must be valid JSON — a single syntax error silently invalidates the entire block
  • Not all schema types qualify for rich results; check Google's supported types documentation
  • Dynamic data injected via client-side JS may not be indexed reliably — prefer server-side rendering
  • Multiple JSON-LD blocks on the same page are allowed and parsed independently

Code Snippets

Product JSON-LD structured data

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "Product Name",
  "image": "https://example.com/product.jpg",
  "description": "Product description.",
  "sku": "SKU-123",
  "brand": { "@type": "Brand", "name": "Brand Name" },
  "offers": {
    "@type": "Offer",
    "url": "https://example.com/product",
    "priceCurrency": "USD",
    "price": "29.99",
    "availability": "https://schema.org/InStock"
  },
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.5",
    "reviewCount": "89"
  }
}
</script>

Context

E-commerce product pages, articles, local business pages, events, recipes

Revisions (0)

No revisions yet.