-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
- I've read and understood the contribution guidelines.
- I've searched for any related issues and avoided creating a duplicate issue.
Please give us a description of what happened.
The current implementation of Yoast SEO for TYPO3 outputs structured data as a JSON array inside the <script type="application/ld+json"> block, like this:
[
{ "@context": "https://schema.org", ... },
{ "@context": "https://schema.org", ... }
]
While this technically works, the JSON-LD specification and Google's documentation recommend publishing multiple objects within a single object using the @graph property and a single @context
The code responsible for this output can be found here:
Classes/StructuredData/StructuredDataProviderManager.php
Function: buildJsonLdBlob()
Please describe what you expected to happen and why.
Structured data to be output as a single object using the recommended @graph format, like this:
{
"@context": "https://schema.org",
"@graph": [
{ ... },
{ ... }
]
}
How can we reproduce this behavior?
- Install and activate the Yoast SEO for TYPO3 extension.
- Visit any frontend page that outputs structured data.
- Inspect the HTML source and locate the <script type="application/ld+json"> tag.
- Observe that the content is a JSON array, and not an object with @graph.
Screenshots
Logs
Additional context
When custom JavaScript tries to access the structured data in Safari browsers, a JavaScript error occurs due to the unexpected array format:
TypeError: undefined is not an object (evaluating 'r["@context"].toLowerCase')
Technical info
- TYPO3 version: 13.4
- Yoast SEO version: 11.0.2
- Relevant extensions in case of a bug: none
Metadata
Metadata
Assignees
Labels
No labels