How I Took ~1,000 Pages From Hundreds of Rich Results Warnings to Zero
Description and use
A PHP script automated the detection of Rich Results warnings across ~1,000 pages by validating required properties, @id references, and JSON‑LD syntax, and was integrated into CI to prevent regressions.
Problem
Hundreds of Rich Results warnings appeared on ~1,000 pages of structured data because JSON‑LD references pointed to nodes that were never defined.
Outcome
The auditor reduced Rich Results warnings from hundreds to zero across ~1,000 pages and provides continuous protection against future regressions.
Workflow
- 1. Extract all
<script type="application/ld+json">blocks from each rendered HTML file. - 2. Run three checks: required properties, @id resolution, and JSON parse errors.
- 3. First pass indexes all nodes with @id to build a definition map.
- 4. Second pass walks each node recursively, validating internal @id references against the map.
- 5. Emit errors for missing properties, unresolved references, or parse failures.
- 6. Return exit code 0 if clean, 1 if errors, 2 if misuse.
- 7. Integrate the script into CI so any new warning causes a build failure.
Evidence
Google flagged hundreds of Rich Results warnings across them.
jsonld-schema-audit is one PHP file with no dependencies.
The exit code ties it together: 0 when clean, 1 when there are errors, 2 for bad usage.
- Record date: 2026-10-13T10:41:26.603Z