1

I am uncertain how to represent search results in JSON-LD. e.g. for a page containing hotel search results, should each hotel be included in an array of LodgingBusiness entities in the emitted JSON-LD snippet.

Is this even desirable given that the search results are not static and will change based on e.g. availability, ordering or other factors?

2
  • Desirable for …? -- Regarding your first question, could you include the different ways you can imagine, or the one you have a question about (as JSON-LD snippet)?
    – unor
    Oct 19, 2016 at 12:33
  • I just found your example here: stackoverflow.com/questions/31729025/… . So assuming that is a valid example of multiple products, my question is assume your t shirt 2 gets sold out, and you remove it from inventory, then the linked data stored by consumers is out of synch until they process the page again.
    – Matt Evans
    Oct 19, 2016 at 12:44

1 Answer 1

2

Schema.org has "SearchResultsPage" for this. I would use it.

Check this example from search results in doctor directory at Google's Structure Data Testing Tool for microdata format as that will allow you to understand the structure.

In ItemList you may have any other types, and it will be easy to connect them using it.

I would say that search engines don't use this much right now, but in Google Search Console you will be able to use Data Highlighter then.

I converted a part into JSON-LD, so it should look like this:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "SearchResultsPage",
  "mainEntity": [{
    "@type": "ItemList",
    "name": "Primary Care Physicians Chicago, IL 60646",
    "itemListOrder": "http://schema.org/ItemListOrderAscending",
    "itemListElement":[{
        "@type": "ListItem",
        "position": 1,
        "item": {
            "@type": "Physician",
            "url": "https://healthjoy.com/doctor/bernadette-b-mayer/5365-w-devon-ave-chicago-il-60646/"
        }

    },
    {
        "@type": "ListItem",
        "position": 2,
        "item": {
            "@type": "Physician",
            "url": "https://healthjoy.com/doctor/vaidotas-petrus/6225-w-touhy-ave-chicago-il-60646/"
        }
    }]
  }]
}
</script>
11
  • 1
    Just checked examples from Structure Data testing Tool It gives the same error. I'd wait, maybe it was some night deploy of the SDTT from Google? :)
    – Nick
    Oct 25, 2016 at 8:15
  • 1
    Just checked with Bing Markup Tool, Linter and checked JSON-LD at PlayGround: everything looks OK. I would say - let's wait for Google's response. Reported about the problem to them.
    – Nick
    Oct 25, 2016 at 8:55
  • 1
    Had some time to play with this, so, especially for you :) All values provided for URL must point to the same page - problem in Google’s SDTT
    – Nick
    Jan 14, 2017 at 0:26
  • 1
    in fact Google's own example for "recipe and list" markup from here: developers.google.com/search/docs/guides/mark-up-listings also fail validation with this same error.
    – Matt Evans
    Apr 3, 2017 at 13:26
  • 1
    @MatthewEvans Their example may not be supported fully and give warnings. I already implemented this scheme for 3 websites after publishing the small blog post at my blog. For now - all works fine. Maybe it was not clear from my blogpost - will try to explain by other words. Just a simple rule: if you describe object fully in the list - you give URL to the same page via anchors. If you provide URLs to other pages - you don't need to provide detailed object description. That's it. There are some recommendations for the combined objects descriptions they ask to follow, SDTT will show that.
    – Nick
    Apr 3, 2017 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.