Canonical mapping developer information
Design
Model
The canonical mapping build process uses the catalog post processing mechanism to process the products (more information can be found here).
The BuildCanonicalMappingsProcessor
uses the CanonicalMappingBuilder
to build up the canonical mappings of catalog listing URL's and the ProductCanonicalMappingBuilder
to build up the canonical mappings of product URL's. This is done by processing each product of the product catalog. Because the resulting output is a mapping of canonical SEO friendly URL's the SeoMappingBuilder
is used to build up a lookup table with the SEO values (for more information, see Developer SEO mapping)
After processing all products the catalog listing and product mappings are combined and translated to SEO URL's. The canonical mappings are saved using IMappingStorage<CanonicalMapping>
. The latter calls the pipeline named mercury.canonical.savedata
for saving the data.
Build canonical mappings sequence diagram
The CanonicalMappingBuilder
used the CanonicalMapper
to process each variant and build up a dictionary of canonical mappings of field sets. When the Build()
method is called the CanonicalMappingBuilder
returns a list of canonical mappings of SEO URL's. A SEO lookup object (of type ISeoLookup
) will be used for retrieving the SEO values of the fields in the field set.
The ProductCanonicalMappingBuilder
processes each variant and build up a list of product and variant canonical mappings. The CanonicalMappingServiceProvider
, which calls the pipeline named mercury.canonical.buildProductCanonical
, is used for retrieving the canonical mapping of a product.
Build canonical mappings class diagram
Configuration
The process for the generation of the canonical mappings is 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.canonical.savedata
- mercury.canonical.getdata
- mercury.canonical.buildProductCanonical
mercury.canonical.savedata
This pipeline saves the canonical mappings.
Mercury provides a processor for saving the canonical mappings to the Sitecore media library and is located in the namespace Mercury.Foundation.Seo.Catalog.Pipelines.SaveData.Canonical
.
mercury.canonical.getdata
This pipeline retrieves the canonical mappings.
Mercury provides a processor for retrieving the canonical mappings from the Sitecore media library and is located in the namespace Mercury.Foundation.Seo.Catalog.Pipelines.GetData.Canonical
.
mercury.canonical.buildProductCanonical
This pipeline retrieves the canonical mapping of a product or variant.
Mercury provides a processor for determining the canonical mapping of a product or variant. This is done by using the SEO value of a product for products, and by using the SEO value of product postfixed by the VariantFormatForProductUrl
setting for variants. The processor is located in the namespace Mercury.Foundation.Seo.Catalog.Pipelines.BuildProductCanonical
.
Configure scheduler
Mercury provides Command
items for the catalog post processing job so this can be scheduled.
The canonical mapping catalog post processing jobs can be scheduled as follow:
- Create a schedule item in Sitecore
- Configure the schedule item
- Command:
/sitecore/system/Tasks/Commands/Mercury SEO Catalog/RebuildCanonicalMappingCommand
- Items: The website root
- Schedule: Schedule when task should run
- Command: