njm5785
njm5785

Reputation: 145

Schema.org SearchAction error for Google Sitelinks Search Box: "valueName: missing and required"

We are using the Schema.org SearchAction on our site in hopes to get the Sitelinks Search Box showing on the Google Search results. I have implemented the code exactly as it says on Google's Developer Page but it is still returning errors when I test it in Google's Test Tool.

Here is the code I am using:

<div itemscope itemtype="http://schema.org/WebSite">
    <meta itemprop="url" content="http://www.examplesite.com"/>
    <form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
        <meta itemprop="target" content="http://www.examplesite.com/catalogsearch/result/?q={q}"/>
        <input itemprop="query-input" type="text" name="q">
        <input type="submit">
    </form>
</div>

This is the error that I am getting:

Structured Data Testing Tool Error

I would like to use Microdata if I can because so far all of our markup uses that. Does anyone know how I might be able to fix this issue?

Upvotes: 3

Views: 3403

Answers (1)

unor
unor

Reputation: 96597

Update: It was a bug in Google’s Testing Tool. The markup from the question (and Googles own documentation) now works again. So there’s no need for the following alternative.


It’s not clear if this is just a temporary bug with their Structured Data Testing Tool, or if their documentation for the Sitelinks Search Box is no longer accurate.

If you think their rules changed (and they forget updating the documentation), you could fix it by providing a PropertyValueSpecification item and its valueName property (as the error message suggests):

<div itemscope itemtype="http://schema.org/WebSite">
    <link itemprop="url" href="http://www.example.com"/> <!-- changed from 'meta' to 'link', as it’s required by HTML5 and Microdata -->
    <div itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
        <meta itemprop="target" content="http://www.example.com/catalogsearch/result/?q={q}"/>
        <div itemprop="query-input" itemscope itemtype="http://schema.org/PropertyValueSpecification">
          <meta itemprop="valueName" content="q"/>
        </div>
    </div>
</div>

FWIW, this gives an "all good" for the "Sitelinks Search Box" in the Structured Data Testing Tool.

Upvotes: 2

Related Questions