1

I want to enhance a search function's semantic meaning using JSON-LD.

The most popular snippet to do that seems to be this one from Google:

<script type="application/ld+json">
{
   "@context": "http://schema.org",
   "@type": "WebSite",
   "url": "https://www.example-petstore.com/",
   "potentialAction": {
     "@type": "SearchAction",
     "target": "https://query.example-petstore.com/search?q={search_term_string}",
     "query-input": "required name=search_term_string"
   }
}
</script>

While I understood how this works, I am wondering if it's possible to combine the SearchAction markup with other parts of Schema.org's vocabulary.

For example when you can search for a hotel room to be available at a specific point in time, is it possible to embed this information using JSON-LD?

Let's say the search string looks like this: search-hotels-global.com/?s=new-york&start=5-5-15&end?19-5-15, how do I implement it in JSON-LD, can I do it just like this?

{
   "@context": "http://schema.org",
   "@type": "WebSite",
   "url": "https://www.example-petstore.com/",
   "potentialAction": {
     "@type": "SearchAction",
     "target": "search-hotels-global.com/?q={search_term_string}&start={start_date_input}&end={end_date_input",
     "query-input": "required name=search_term_string",
     "query-input": "name=start_date_input",
     "query-input": "name=end_date_input",
   }
}
unor
  • 92,415
  • 26
  • 211
  • 360
Sven
  • 12,997
  • 27
  • 90
  • 148

1 Answers1

2

Not, that's not possible. First of all it's invalid JSON-LD as it uses the same property multiple times in an object (you would need to change the latter two query_inputs to something else) and secondly Google doesn't support multiple URL parameters. You can test it in Google's Structured Data Testing tool at https://developers.google.com/structured-data/testing-tool/

Markus Lanthaler
  • 3,683
  • 17
  • 20
  • JSON-LD may have multiple equal properties, as can be seen at https://developers.google.com/structured-data/slsb-overview#how_do_you_set_it_up under site+app tab and in the source-code of https://www.pinterest.com (they use microdata instead json-ld) – RanSch Apr 20 '16 at 15:30