2

I want to enable Google Sitelinks Search Box for a website. The point is its custom search page is implemented by hash fragment so the JSON-LD data snippet is like this:

<script type="application/ld+json">
  {
  "@context": "http://schema.org",
  "@type": "WebSite",
  "name" : "my site",
  "alternateName" : "example.com",
  "url": "http://www.example.com/",
  "potentialAction": {
    "@type": "SearchAction",
    "target": "http://www.example.com/Search/#!/Keyword-{search_term_string}",
    "query-input": "required name=search_term_string"
  }
}
</script>

While Google tries to extract the information from this part "required name=search_term_string" to show the sitelinks search box, encounter a problem:

:   http://schema.org/True
valueName:  missing and required

I suspect maybe Google just expect search string inside a query string instead of hash fragment, what do you recommend except redirecting?

unor
  • 92,415
  • 26
  • 211
  • 360
Un4g1v3n
  • 316
  • 3
  • 16
  • 1
    possible duplicate of [Sitelinks Search Box JSON-LD giving error on Google Structured Data Testing Tool](http://stackoverflow.com/questions/30780247/sitelinks-search-box-json-ld-giving-error-on-google-structured-data-testing-tool) – unor Jun 13 '15 at 17:10

1 Answers1

6

Thanks to @unor I found the solution, so the final code is something like this:

<script type="application/ld+json">
        {
          "@context": "http://schema.org",
          "@type": "WebSite",
          "name" : "example",
          "alternateName" : "example.com",
          "url": "http://www.example.com/",
          "potentialAction": {
            "@type": "SearchAction",
            "target": "http://www.example.com/Search/#!/Keyword-{search_term_string}/",
            "query-input": {
          "@type": "PropertyValueSpecification",
          "valueRequired": true,
          "valueMaxlength": 100,
          "valueName": "search_term_string"
      }
          }
        }
</script>
Un4g1v3n
  • 316
  • 3
  • 16
  • Thanks for post solution – waki Jun 23 '15 at 10:42
  • 2
    @Waki and HosseinBakhtiari: note that [it was a bug in Google’s Testing Tool](http://stackoverflow.com/a/31145753/1591669), which is now fixed. So the original markup seems to work again. – unor Jun 30 '15 at 18:31
  • Thanks @unor, by the way how much it takes for Google to respond to this change and show it inside SERP for a high traffic website(10'000 concurrent users)? – Un4g1v3n Jul 02 '15 at 06:22