I'm planning on implementing a google site search (and paying for it so I can 开发者_JAVA百科get access to the XML). One thing I am wondering about is the possibility to use custom meta tags in it.
I've heard yes from colleagues but nothing confirmed. Searching for an answer has given nothing (maybe because you cant?)
Anybody knows?
Edit: I want to be able to retrieve those meta tags from the search result to be able to provide different styling for different types of pages.
Yes, you can do this, although not, as far as I know, using meta tags. Instead, google allows you to put custom attributes inside your HTML, which can then be retrieved from the XML you get back from Google Custom Search results API.
Take a look at http://code.google.com/apis/customsearch/docs/snippets.html for more info on how this works. The Structured Data section outlines the specific ways you can stick custom metadata inside your page so Google will hand it back to you along with each search result. The easiest seems to be a PageMap, which is an HTML comment inside your HEAD, like this:
<!--
<PageMap>
<DataObject type="document">
<Attribute name="title">The Biomechanics of a Badminton Smash</Attribute>
<Attribute name="author">Avelino T. Lim</Attribute>
<Attribute name="description">The smash is the most explosive and aggressive stroke in Badminton.
Elite athletes can generate shuttlecock velocities of up to 370 km/h.
To perform the stroke, one must understand the biomechanics involved,
from the body positioning to the wrist flexion. </Attribute>
<Attribute name="page_count">25</Attribute>
<Attribute name="rating">4.5</Attribute>
<Attribute name="last_update">05/05/2009</Attribute>
<Attribute name="thumbnail">http://www.example.com/papers/sic.png" width="627" height="167" />
</DataObject>
</PageMap>
-->
If you absolutely must use META tags, the Bing Search API does support indexing all meta tags whose NAME property starts with "Search.", e.g.
<meta name="Search.MyCustomProp" content="Hola mi amigo Google, I want my META!">
Then in the Bing Results API you can pull out all these values using the WebResult.SearchTag property
. When issuing the request, you'll either need the WebRequest.SearchTags Property
or you can just add text to your search query, e.g. poodle meta:search.MyCustomProp(amigo)
searches for the word "poodle" on pages where the search.MyCustomProp meta tag contains the word "amigo". Using the Bing API is free as long as you stay under 7 queries per second and adhere to some other restrictions detailed here.
Sorry to be talking so much about Bing, feel free to ignore that part-- but I have had reasonably positive experiences using the Bing API at a previous job.
Can you detail more about the meta tags you want to use. You can add meta tags and it should not matter to Google.
精彩评论