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, Programmable Search Engine 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 "Fullscreen 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 indexing via the Search Console. This is a good option if you don’t want PageMap exposed in the HTML source code of your page.
- Add embedded structured data markup or meta tags to your HTML page. Programmable Search Engine 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 Programmable Search Engine 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 |
To create a PageMap, add a block of code to your HTML page, like this:
<!-- <PageMap> <DataObject type="action"> <Attribute name="label" value="Download"/> <Attribute name="url" value="http://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.
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 indexing via the Search Console.
Here's an example of a Sitemap that includes PageMap information for two URLs: http://example.com/foo and http://example.com/bar.
<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://sitemaps.org/schemas/sitemap/0.9" xmlns:content="http://google.com/schemas/sitemap-content/1.0"> <url> <loc>http://example.com/foo</loc> <PageMap xmlns="http://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://example.com/bar</loc> <PageMap xmlns="http://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 Programmable Search Engine 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. )