Submit PageMaps Directly to Google Custom Search Engine via Sitemaps or On-Demand Indexing Requests

Custom Search users have long been able to create Richer Snippets by adding Pagemaps to their webpages. Today, Google Custom Search team annnounced of enabling direct submission of Pagemaps via either Sitemaps or On-Demand Indexing requests. "This means you no longer have to modify your pages to expose Pagemaps, or wait for Google to crawl […]

Custom Search users have long been able to create Richer Snippets by adding Pagemaps to their webpages.

Today, Google Custom Search team annnounced of enabling direct submission of Pagemaps via either Sitemaps or On-Demand Indexing requests. "This means you no longer have to modify your pages to expose Pagemaps, or wait for Google to crawl your site to process them," informed Google CSE team blog.

"This saves time when you want to make a quick change to your metadata. If you have data you would like to be displayed on your site, such as reviews snippets, you can submit it directly to Google instead of putting it in publicly visible markup on your pages."

"For added security, you can even choose to add a private key to your Pagemap and we will only serve it in Custom Search results when that key is provided," Google added.

Here's an example of how to add PageMap data directly to your HTML page:

<html>
  <head>
   ...
  <!--
  <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>
     </dataobject>
     <dataobject type="thumbnail">
        <attribute name="src" value="http://www.example.com/papers/sic.png" />
        <attribute name="width" value="627" />
        <attribute name="height" value="167" />
     </dataobject>
  </pagemap>
  -->
  </head>
   ...
</html>

Here's an example of a Sitemap that includes PageMap information for two URLs: http://www.example.com/foo and http://www.example.com/bar.

<?php xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
       xmlns:content="http://www.google.com/schemas/sitemap-content/1.0">
 <url>
   <loc>http://www.example.com/foo</loc>
   <pagemap xmlns="http://www.google.com/schemas/sitemap-pagemap/1.0">
     <dataobject type="document" id="hibachi">
       <attribute name="name">Dragon</attribute>
       <attribute name="review">3.5</attribute>
     </dataobject>
   </pagemap>
 </url>
 <url>
   <loc>http://www.example.com/bar</loc>
   <pagemap xmlns="http://www.google.com/schemas/sitemap-pagemap/1.0">
     <dataobject type="document" id="biggreenegg">
       <attribute name="name">Ribs</attribute>
       <attribute name="review">4.0</attribute>
     </dataobject>
   </pagemap>
 </url>
</urlset>

To submit PageMap data using the Custom Search Control API, send an HTTP POST message, using the text/xml content type, to: http://www.google.com/cse/api/default/index/. Include PageMap data in the message body, like this:

<ondemandindex>
<pages>
  <page url="http://www.example,com/monkeys/">
    <pagemap>
      <dataobject type="document">
        <attribute name="title">Monkeys</attribute>
        <attribute name="review">4.0/5.0</attribute>
      </dataobject>
      <dataobject type="stats">
        <attribute name="installs">1000</attribute>
        <attribute name="comments">100</attribute>
      </dataobject>
    </pagemap>
  </page>
  <page url="http://www.example.com/parrots">
    <pagemap>
      <dataobject type="document">
        <attribute name="title">Parrots</attribute>
        <attribute name="review">4.5/5.0</attribute>
      </dataobject>
      <dataobject type="stats">
        <attribute name="installs">2000</attribute>
        <attribute name="comments">200</attribute>
      </dataobject>
    </pagemap>
  </page>
</pages>
</ondemandindex>

Here's an example of an AccessKey in use:

<page url="http://www.example.com/monkeys/">
    <pagemap>
      <dataobject type="stats">
        <accesskey>myprivate12345</accesskey>
        <attribute name="installs">1000</attribute>
        <attribute name="comments">100</attribute>
      </dataobject>
    </pagemap>
  </page>

For more information, please visit this PageMap page.