Create Friendly URLs for Catalog Items
Create URLs to content without using query strings.
Complete the following prerequisites:
-
There are one or more virtual or base catalogs containing product and category definitions.
At your Visual Studio solution setup:
-
Create a new pipeline processor
web.configfile in/configuration/sitecore/pipelines/httpRequestBeginunder thehttpRequestBeginpipeline, inserted before theItemResolverprocessor.This processor will find urls of a specific format and the associated item, then set
Sitecore.Context.Itemto that item. -
Edit your
patch configfile. -
Parse URLs with
Routes. -
Retrieve the item using
SearchNavigation.GetProductorSearchNavigation.GetCategory -
Cache the mapping between the URL and the Sitecore item id.
-
Create a new link provider that will render links for catalog and product items in a specific form.
-
Inherit from the Sitecore LinkProvider and call the base provider if the item is not a product or category
-
Check if an item is a product or category by using
SearchHelpers.IsItemProductorSearchHelpers.IsItemCategory
-
-
Register your link provider in your include file and set it as the new default link provider.