Sitemap developer information
Design
Functional
There are three types of sitemap files which are generated:
- Content: contains the sitemap of content pages
- Category: contains the sitemap of catalog listing pages
- Product: contains the sitemap of product pages
The category and product sitemap contains the canonical URL's of the catalog listing and product pages respectively.
Model
Each sitemap build process uses their own builder to build up sitemap items. After all of the sitemap items have been build the SitemapStorage
is used for saving the sitemap. The SitemapStorage
calls the pipeline named mercury.sitemap.savedata
for saving the data.
The catagory and product sitemap build process uses the catalog post processing mechanism to process the products (more information can be found here).
These processors BuildCategorySitemapProcessor
and BuildProductSitemapProcessor
use their own builder (CategorySitemapBuilder
, ProductSitemapBuilder
) for building up the sitemap of catalog listing and product pages.
In the category and product sitemap canonical URL's are included of the catalog listing pages and product pages. The CanonicalMappingBuilder
and the ProductCanonicalMappingBuilder
are used for retrieving the canonical URL's of the items.
Generation of the content sitemap is configured with an event handler and is done with the ContentSitemapGenerator
. The ContentSitemapGenerator
retrieves all Sitecore items of template IncludeInSitemap
which has the IncludeInSitemap
setting set to true.
Configuration
The processes for the generation of the category and sitemap are configured in the catalogPostProcessor
configuration section. For more information, see the catalog post processing article.
Extension points
Pipelines
The following pipelines are offered as extension points for customization:
- mercury.sitemap.savedata
- mercury.sitemap.getdata
mercury.sitemap.savedata
This pipeline saves the sitemap files.
Mercury provides the following processors:
- Processors for saving the category and product sitemap. These are located in the namespace
Mercury.Foundation.Seo.Catalog.Pipelines.SaveData.Sitemap
. - Processor for saving the content sitemap located in the namespace
Mercury.Foundation.Seo.Sitemap.Pipelines.SaveData
.
mercury.sitemap.getdata
This pipeline retrieves the sitemap files. Because the sitemap items aren't required by other modules but just served by the website, the pipeline returns the sitemap as stream.
Mercury provides a processor for retrieving the sitemap files from the Sitecore media library which is located in the namespace Mercury.Foundation.Seo.Sitemap.Pipelines.GetData
.
Configure scheduler
Mercury provides Command
items for the catalog post processing job so this can be scheduled.
The sitemap catalog post processing jobs can be scheduled as follow:
- Create a schedule item in Sitecore
- Configure the schedule item
- Command:
- Categories sitemap:
/sitecore/system/Tasks/Commands/Mercury SEO Catalog/RebuildCategorySitemapCommand
- Product sitemap:
/sitecore/system/Tasks/Commands/Mercury SEO Catalog/RebuildProductSitemapCommand
- Content sitemap:
/sitecore/system/Tasks/Commands/Mercury SEO Sitemap/RebuildContentSitemapCommand
- Categories sitemap:
- Items: The website root
- Schedule: Schedule when task should run
- Command: