2

I'm using Google CSE on my website and I want to have the search results display differently than the standard method. I've found this:

http://code.google.com/apis/customsearch/docs/snippets.html

I'm a little confused on the steps on how to style the results to my liking. I know that I have to create the structured data in my pages first (ie Pagemaps).

What does the second step mean though

"Fetch that structured data in the search results for your Custom Search Engine. The Custom Search server can return the search results, along with the structured data, in XML or JSON format. "

And for the third step, do I just copy the code provided in the Custom Search Element?

Thanks in advance

4

1 に答える 1

0

"カスタム検索エンジンの検索結果でその構造化データを取得します。カスタム検索サーバーは、検索結果を構造化データとともに XML または JSON 形式で返すことができます。"

自分でそれらを取得する必要はありません。インデックス作成はそれを意味していると思います。Google にサイトの再インデックスを強制したり、Google のサービスを通じて直接ページマップをアップロードしたりすることができます: https://developers.google.com/custom-search/docs/structured_data#pagemaphttp

その後、JSON URL からデータをリクエストするだけです。

https://www.google.com/cse?cx=[CSEID]&q=animal&output=xml&sort=myprivate12345-document-rating&pgmpk=myprivate12345

3 番目のステップでは、カスタム検索要素で提供されているコードをコピーするだけですか?

Javascript を使用する場合は、JSON で結果をリクエストするのが最適です。その後、それはコード内のオブジェクトになり、それをスタイルしたり、他のことをしたりできます。

于 2015-05-12T06:21:29.500 に答える