PageMaps is a structured data format that Google created to enable website creators to embed data and notes in their webpages. Although the structured data isn't visible to your users, and doesn't impact your site's listing in Google Web Search results, Custom Search recognizes it and can use it to add elements such as actions or custom attributes to search results pages.
Here's an example of a rich snippet that features two actions ("Download" and "Full Page View"):
You submit PageMaps in three ways. You can:
- Add PageMap data directly to your HTML page. Google will discover the PageMap information when we crawl your site.
- Add PageMap data to a Sitemap, and submit that Sitemap for on-demand indexing. This is a good option if you don’t want PageMap exposed in the HTML source code of your page.
- Use rich snippets markup or meta tags to add structured data directly to your HTML. Custom Search will convert this data to PageMaps when we crawl and index your site.
PageMap elements
Each element (for example, an action) that you want to add to a snippet is a DataObject. Each DataObject has a number of attributes, such as a label or URL, which you can customize as you choose.
Recognized DataObjects
You can create any type of DataObject you like, but Google Custom Search recognizes the DataObjects listed in the following table, and will render them in search results:
| DataObject | Required attributes |
|---|---|
thumbnail |
src, height, width |
action |
label, url, class |
publication |
author, date, category |
Add PageMap data directly to your HTML page
To create a PageMap, add a block of code to your HTML page, like this:
<!--
<DataObject type="action">
<Attribute name="label" value="Download"/>
<Attribute name="url" value="http://www.scribd.com/document_downloads/20258723?extension=pdf"/>
<Attribute name="class" value="download"/>
</DataObject>
<DataObject type="action">
<Attribute name="label" value="Fullscreen View"/>
<Attribute name="url" value="http://d1.scribdassets.com/ScribdViewer.swf?document_id=20258723&access_key=key-27lwdyi9z21ithon73g3&version=1&viewMode=fullscreen"/>
<Attribute name="class" value="fullscreen"/>
</DataObject>
</PageMap>
-->
Be sure to enclose your PageMap inside <!-- and --> tags.
Add PageMap data to a Sitemap
If you don't want to include PageMap data in the HTML of your pages, you can add PageMap data to a Sitemap and submit that Sitemap for on-demand indexing.
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.
<?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>
PageMap tag definitions
The following table outlines the requirements for adding PageMap data to a sitemap. For more information about creating Sitemaps, including basic tag definitions, see Creating Sitemaps.
| Tag | Required? | Description |
|---|---|---|
PageMap |
Yes | Encloses all PageMap information for the relevant URL. |
DataObject |
Yes | Encloses all information about a single element (for example, an action) that should appear in the Custom Search result. |
Attribute |
Yes | Each DataObject contains one or more attributes. |
(If you’re a developer, you can take advantage of the flexibility of PageMaps to add extra functionality to your search results. More information.
)
