Hello, I'm trying to get google's sitelinks search box working in my site.
Introductions: https://developers.google.com/structured-data/slsb-overview?hl=fi
I have tested my dev site with this tool:
https://developers.google.com/structured-data/testing-tool/
and I get two errors:
"Google does not recognize the attribute type WebSite target destination."
"Google does not recognize the attribute query-input type WebSite destination."
I using drupal, but here is my codes:
script is in <head> section:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "http://www.Mysite.com/",
"name":"Mysite.com",
"potentialAction": {
"@type": "SearchAction",
"target": "http://www.Mysite.com/search?keyword={search_term_string}&type=article",
"query-input": "required name=search_term_string"
}
}
</script>
search from wrapper
<input itemprop="query-input" name="keys" type="text" size="" value="" id="edit-keys" class="form-control search-field-custom" placeholder="<?php echo t('Search'); ?>" required/>
search form
<div itemscope itemtype="http://schema.org/WebSite">
<meta itemprop="url" content="http://www.Mysite.com/"/>
<form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction" class=" navbar-form navbar-right" action="<?php echo $base_url . $form['#action'] ?>" method="post" id="search-form" accept-charset="UTF-8">
<meta itemprop="target" content="http://www.Mysite.com/search?keyword={keys}&type=article"/>
<?php print render($form['basic']['keys']);?>
<?php print drupal_render_children($form); ?>
</form>
</div>
When I change <input name="keys"> to something else, my search not working anymore. This is drupal search block and I don't get this working. :/