2

ウェブサイトでGoogle サイトリンク検索ボックスを有効にしたいと考えています。ポイントは、カスタム検索ページがハッシュ フラグメントによって実装されているため、JSON-LD データ スニペットは次のようになることです。

<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>

Google がこの部分から情報を抽出し"required name=search_term_string"てサイトリンクの検索ボックスを表示しようとすると、次のような問題が発生します。

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

Google はハッシュ フラグメントの代わりにクエリ文字列内の検索文字列を期待しているのではないかと思いますが、リダイレクト以外に何をお勧めしますか?

4

1 に答える 1

6

@unor のおかげで解決策を見つけたので、最終的なコードは次のようになります。

<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>

于 2015-06-21T09:55:04.173 に答える