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?

unor
  • 92,415
  • 26
  • 211
  • 360
Matt Evans
  • 7,113
  • 7
  • 32
  • 64
  • 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 '16 at 12:33
  • I just found your example here: http://stackoverflow.com/questions/31729025/creating-an-array-of-products-in-json-ld . 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 '16 at 12:44

1 Answers1

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>
Nick
  • 225
  • 1
  • 10
  • the example you sent (and my generated JSON-LD) fails validation on the STDT wth the error : All values provided for url must point to the same page . – Matt Evans Oct 24 '16 at 08:11
  • Thanks, Matthew. I will check, cause it seems something changed in Google SDT, as this was passing test fine a week ago. Will update the post once I get to this. – Nick Oct 25 '16 at 08:06
  • 1
    Just checked examples from [Structure Data testing Tool](https://developers.google.com/search/docs/guides/mark-up-listings) It gives the same error. I'd wait, maybe it was some night deploy of the SDTT from Google? :) – Nick Oct 25 '16 at 08:15
  • 1
    Just checked with [Bing Markup Tool](https://www.bing.com/webmaster/diagnostics/markup/validator?rflid=1), [Linter](http://linter.structured-data.org/?url=https:%2F%2Fhealthjoy.com%2Ffind-a-doctor%2Fpcp%2Fchicago-il-60646%2F) and checked JSON-LD at [PlayGround](http://json-ld.org/playground/): everything looks OK. I would say - let's wait for Google's response. Reported about the problem to them. – Nick Oct 25 '16 at 08:55
  • Google still doing strange things with url. Had been using Yandex structured test tool: https://webmaster.yandex.com/tools/microtest/ – Matt Evans Nov 09 '16 at 13:23
  • Can you clarify your comments about using data highlighter @Nick:? – Matt Evans Nov 15 '16 at 13:27
  • I am sorry, @MatthewEvans, Probably misunderstood what do you want me to clarify? – Nick Nov 23 '16 at 11:35
  • 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](https://dmytronikolayev.com/values-provided-url-must-point-page-problem-googles-sdtt/) – Nick Jan 14 '17 at 00:26
  • eventually got around to refactoring this. Its kind of limiting to use the non-nested item, as the items have to be of type ListItem and you can't pass additional meta data (eg. LodgingBusiness specific properties and are limited to the properties of Thing and ListItem. kind of defeats the purpose of 'rich' snippets? Feels wrong to me – Matt Evans Apr 03 '17 at 13:14
  • 1
    in fact Google's own example for "recipe and list" markup from here: https://developers.google.com/search/docs/guides/mark-up-listings also fail validation with this same error. – Matt Evans Apr 03 '17 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 03 '17 at 16:52