Fix home page JSON-LD crashing structured-data readers#19
Draft
posthog[bot] wants to merge 1 commit into
Draft
Conversation
The home page injected its JSON-LD as a bare top-level array, so any consumer treating the parsed structured data as a single object read `undefined["@context"]` and crashed. Wrap the three entities in a `@graph` with one top-level `@context` and drop the now-redundant per-object `@context`. Generated-By: PostHog Code Task-Id: 4d331e29-d220-4346-b6c8-43e10e90a2be
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
The home page injected its schema.org JSON-LD as a bare top-level array (
JSON.stringify([organizationJsonLd, productJsonLd, faqJsonLd])). Each object carried its own@context, but the array itself had none, so any consumer that treats the parsed JSON-LD as a single object readsr["@context"]→undefinedand crashes calling.toLowerCase()on it.This wraps the three entities in a single
@graphwith one top-level@context, and drops the now-redundant per-object@contextinseo.ts. This both removes the crash trigger and produces a more standard structured-data shape (a small SEO correctness gain).Why
Error tracking captured an unhandled
TypeError: undefined is not an object (evaluating 'r["@context"].toLowerCase')onhttps://amend.sh/(Safari 26.3, 2026-06-06). The crashing code is an injected third-party JSON-LD reader (browser extension / structured-data reader), but the bare-array shape is what triggers it.Created with PostHog Code from an inbox report.