feat(schema-validity): add page-level JSON-LD validity analyzer (1.7.0)#26
Merged
feat(schema-validity): add page-level JSON-LD validity analyzer (1.7.0)#26
Conversation
New `schema-validity` analyzer (weight 5) flags problems missed by existing factors: - Duplicate singleton @types per page (e.g., two FAQPage blocks — Google flags as "Duplicate field" and invalidates rich results) - JSON syntax errors in any application/ld+json block (previously silently swallowed by parseJsonLdScripts) - Empty / whitespace-only JSON-LD script blocks When a structural error exists (parse error or duplicate singleton), the factor's score is capped at 69 so the issue surfaces in text-mode top recommendations regardless of how many other factors are also failing — schema errors must be visible irrespective of the numeric score. Adds `extractJsonLdBlocks()` helper for richer per-block introspection (index, parse error, top-level @types, handles @graph and @type arrays). Existing parseJsonLdScripts is untouched (still used by other analyzers). Co-Authored-By: Claude Opus 4.7 <[email protected]>
The new schema-validity factor scores 100 on the strong fixture (clean, non-duplicate JSON-LD), shifting the weighted overall from 75 to 76 and promoting it into the top-2 strengths in the summary string. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
schema-validityanalyzer (weight 5) catches issues silently dropped byparseJsonLdScripts: duplicate singleton@types on a page (e.g. twoFAQPageblocks — Google flags as "Duplicate field" and invalidates rich results), JSON syntax errors, and empty<script type="application/ld+json">blocks.extractJsonLdBlocks()helper for richer per-block introspection (index, parse error, top-level@types; handles@graphand@type-array). ExistingparseJsonLdScriptsis untouched.ANALYZER_BY_ID+FACTOR_DEFINITIONS, doc-synced acrossprintHelp()/ README /skills/aeo/SKILL.mdper the CLAUDE.md rule, version bumped 1.6.0 → 1.7.0.Test plan
pnpm typecheckcleanpnpm test— 146/146 pass (14 new intest/analyzers/schema-validity.test.ts)pnpm lintcleanpnpm run buildcleandist/: duplicate FAQPage → score 69 with cited block indices; malformed JSON → 69 with parser line/column; clean → 100; no JSON-LD → 100 with info finding🤖 Generated with Claude Code