-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSONLD parsing failed; array was returned where itemtype was expected #43
Comments
We tested a fix by trying to always return the first result in case an array was detected, but that seems to have side effects. @jkphl any idea what would be going on here? |
I made this modification for now, since I don't really care about multiple types on this. protected function parseNodeType(NodeInterface $node)
{
/** @var Node $itemType */
$itemType = $node->getType();
if (is_array($itemType))
$itemType = reset($itemType);
return $itemType ? [$this->vocabularyCache->expandIRI($itemType->getId())] : [];
} |
We tried something similar, but had the idea it had a regression. Could you create a PR to see if all tests would pass? When using that snippet, we get a server error (exception can not get caught) when parsing the following URL: https://www.adamenfroy.com/how-to-make-money-on-youtube As you can see, apparently the Yoast SEO plugin allows putting two types on the graph objects.
|
@Sarke thank you for your snippet! It made me think about what could go wrong, and after some more debugging we found out that the We had over 5,000 events in Sentry already. PR #46 fixes that. |
Thanks @rvanlaak! As for the Yoast SEO issue, I used the snippet in combination with the |
For clarification; it's not a problem caused by the Yoast plugin, as it is perfectly fine to have more than one "@type": [
"Person",
"Organization"
], |
Parsing fails on
JSONLD::parseNodeType
:Happens on parsing the following URL:
https://www.thelocal.es/20190227/why-is-veganism-on-the-rise-among-young-people-in-spain
The text was updated successfully, but these errors were encountered: