Vanity URLs in EDP
Commerce IO implements Jahia’s built in Vanity URL functionality to create human-readable URLs for a better user experience. Vanity URLs are used to access and retrieve product and catalog pages. Using Vanity URLs, Commerce IO can work with and parse the paths in an easier manner when performing node discovery in the External Data Provider (EDP).
In the EDP, Commerce IO implements the search method to search the Elasticsearch index for the specified product and to perform product and catalog Vanity URL node discovery.
You can change and modify prefixes in the StoreDataSource class found in the org.jahia.modules.commerce.io.edp.datasource package.
Vanity URLs are used only in Live mode. In Preview and Edit mode, URLs use the node path mounted by the EDP.
URL syntax
The Vanity URL structure contains a prefix that identifies the type of resource to retrieve, for example, products or catalogs. The prefix is followed by the locale which enables you to provide I18N resources. The final part of the path is a unique string that identifies the actual resource. The identifier for a product is the SKU or code and the identifier for a category is the name of the category. You can access child categories by providing a hierarchical path, for example, /brands/burton.html.
The following shows the syntax for product and catalog vanity URLs.
- Product -
/products/{locale}/{sku}.html
- Catalog -
/catalogs/{locale}/{category}.html
- Child categories can be accessed by:
/catalogs/{locale}/{parentCategory}/{childCategory}.html
- Child categories can be accessed by: