Fix invalid schema.org JSON-LD on book detail pages#2932
Draft
posthog[bot] wants to merge 1 commit into
Draft
Conversation
The book detail page's structured-data builder keyed the schema.org context as `@content` instead of `@context`, so every emitted `application/ld+json` block was missing its required `@context` field. Consumers reading `r["@context"].toLowerCase()` got `undefined` and threw a TypeError. Also corrects the nested entity keys from bare `type` to `@type` (`Book`, `Organization`) so the markup is valid schema.org throughout. Generated-By: PostHog Code Task-Id: 47ed5f34-f836-4246-9518-b2034750d7e9
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
Book detail pages emitted invalid schema.org JSON-LD because
setJsonLdkeyed the structured-data context as@contentinstead of@context(src/app/pages/details/details.tsx). The injectedapplication/ld+jsonblock was therefore missing its required@contextfield, and a JSON-LD consumer readingr["@context"].toLowerCase()gotundefinedand threw aTypeError.This renames the key to
@contextand, while there, corrects the nested entity keys from baretypeto@type(Book,Organization) so the whole object is valid schema.org.Why
The typo made structured data invalid on every book detail page, undercutting SEO rich-result eligibility across a class of high-traffic pages. (The runtime error itself was low-volume, but the correctness/SEO impact is broad.)
Created with PostHog Code from an inbox report.