When multiple json-ld tags, only parses data from one of them.
mdrideout opened this issue ยท 4 comments
Example at https://www.foodnetwork.com/recipes/food-network-kitchen/swedish-pancakes-recipe-1972715
The parsed jsonld is only showing the data within the second <script type="application/ld+json"> tag.
Google's structured data testing tool correctly picks up the recipe in the first tag, as an example.
https://search.google.com/structured-data/testing-tool/u/0/#url=https%3A%2F%2Fwww.foodnetwork.com%2Frecipes%2Ffood-network-kitchen%2Fswedish-pancakes-recipe-1972715
Thanks for the example! I'll look into how this should be handled better ๐
I'm not 100% certain on the correct behaviour, but I think merging into an array would be correct. Can you check #21 and validate if that approach would work for you?
Yes, that looks like a good solution. I was going to use cheerio to push the json-ld content of each set of <script type="application/ld+json"> tags into an array. So it looks like your update effectively does the same thing.
Thanks for looking at this so quickly!
Always good to hear it's solved the way you'd expect ๐