9

I implemented Google’s Sitelinks Search Box to my site. It was working very well. But today I cheked again on Google Structured Data Testing Tool and something was wrong. Now I’m getting below error:

Google Structured Data Testing Tool: 2 Errors for WebSite

And my implementation is:

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

When I check the JSON on the JSON-LD playground everything is looking good. I didn’t change anything on my site. Is Google wrong about this issue? Or the Schema.org structure has changed? What should I do to fix these 2 problems?

hakki
  • 6,181
  • 6
  • 62
  • 106

3 Answers3

12

Found the answer by reviewing the schema.org Potential Actions page.

Apparently, for whatever reason, Google’s Structured Data Testing Tool doesn’t like our short-hand version for textual representations of input and output.

When I switched to the verbose version I get the good checkmark for WebSite (1), not http://www.example.com/Website (1).

Textual representations of Input and Output

For convenience, we also support a textual short-hand for both of these types that is formatted and named similarly to how they would appear in their HTML equivalent. For example:

"<property>-input": {
  "@type": "PropertyValueSpecification",
  "valueRequired": true,
  "valueMaxlength": 100,
  "valueName": "q"
}

Can also be expressed as:

<property>-input: "required maxlength=100 name=q"

Here is our full code for anyone else trying to follow this:

<script type="application/ld+json">
{

  "@context": "http://schema.org",
  "@type": "WebSite",
  "name" : "Example Company",
  "url": "http://www.example.com/",
  "sameAs" : [ "https://www.facebook.com/pages/Example/###############",
    "https://plus.google.com/b/#####################/#####################"],
  "potentialAction": {
    "@type": "SearchAction",
    "target": "http://www.example.com/search/results/?q={q}",
    "query-input": {
        "@type": "PropertyValueSpecification",
        "valueRequired": true,
        "valueMaxlength": 100,
        "valueName": "q"
    }
  }
}
</script>
unor
  • 92,415
  • 26
  • 211
  • 360
Mike A
  • 244
  • 1
  • 10
  • @unor Thanks for the edit - I was having the hardest time getting the formatting right here... :) – Mike A Jun 15 '15 at 20:40
6

I noticed that even the examples on the online documentation receive the same exact error you received. When I changed

"@context": "http://schema.org"

to

"@context": "http://schema.org/true"

the error disappeared. Hope this helps.

enter image description here

<script type="application/ld+json">
{
  "@context": "http://schema.org/true",
  "@type": "WebSite",
  "url": "https://www.saatler.com/",
  "potentialAction": {
    "@type": "SearchAction",
    "target": "https://www.saatler.com/arama?ara={search_term_string}",
    "query-input":"required name=search_term_string"
  }
}
</script>
Franco
  • 566
  • 3
  • 12
  • I am getting the same error, but am using microdata - Any thoughts? – Mike A Jun 11 '15 at 18:35
  • @skeetarian change http://schema.org/ to http://schema.org/true on your microdata – hakki Jun 11 '15 at 19:12
  • 1
    @hakkikonu - Thanks! I switched to the LD JSON option but now am wondering why it now says "http"//www.example.com/WebSite" instead of just "WebSite" I noticed that when I use the /true option it allows me to use "logo", but without it the "logo" is disallowed for WebSite. This is turning out to be quite the hornets nest... – Mike A Jun 11 '15 at 20:21
  • 1
    @hakkikonu and Franco: By using a different `@context` URI, you are no longer using the Schema.org vocabulary. – unor Jun 12 '15 at 09:31
  • 2
    I believe you should accept my answer as the correct one as this one, while getting the Google good checkmark, does so for an incorrect @context and may cause others to implement an incorrect 'fix'. :) – Mike A Jun 16 '15 at 21:37
  • The page http://schema.org/true doesn't exist. What's the point in changing it? – ursuleacv Oct 08 '19 at 18:18
2

It was a bug in the Google Structured Data Testing Tool.

It’s fixed now: the tool reports no more errors for your markup.

unor
  • 92,415
  • 26
  • 211
  • 360