Skip to content

Fix invalid breadcrumb JSON-LD#217

Merged
aerni merged 1 commit into
mainfrom
fix/breadcrumb-schema-invalid-json-ld
Apr 30, 2026
Merged

Fix invalid breadcrumb JSON-LD#217
aerni merged 1 commit into
mainfrom
fix/breadcrumb-schema-invalid-json-ld

Conversation

@aerni
Copy link
Copy Markdown
Owner

@aerni aerni commented Apr 30, 2026

This PR fixes the breadcrumb JSON-LD coming out invalid. Closes #215.

spatie/schema-org's serializeProperty() only recurses into PHP arrays,
so the Laravel Collection passed to itemListElement() got coerced via
__toString() into a JSON string. That left BreadcrumbList with a
stringified itemListElement and per-item @context, which Search Console
flagged as invalid (#215). Calling ->all() lets serializeProperty
recurse normally and strip the nested @context.
@aerni aerni merged commit c2466ef into main Apr 30, 2026
17 checks passed
@aerni aerni deleted the fix/breadcrumb-schema-invalid-json-ld branch April 30, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Breadcrumb JSON-LD invalid — nested @context and itemListElement as string

1 participant