Category Page URL Format
This configures the URLs of the category or product list pages and supports the following options:
{{page}}.html/{{url_path}}.html
(default){{page}}.html/{{url_key}}.html
If there is the Venia Reference store:
{{page}}
is replaced by/content/venia/us/en/products/category-page
{{url_key}}
is replaced by the category’surl_key
property{{url_path}}
is replaced by the category’surl_path
With the above example data, a category page URL formatted using the default URL format looks like /content/venia/us/en/products/category-page.html/venia-bottoms/venia-pants.html
.
url_path
is a concatenation of the url_keys
of a product or category’s ancestors and the product or category’s url_key
separated by /
slash.Specific Category-/Product-Pages
It is possible to create multiple category and product pages for only a specific subset of categories or products of a catalog.
The UrlProvider
is pre-configured to generate deep links to such pages on author tier instances. This is useful to editors, that browse a site using Preview mode, navigate to a specific product or category page and switch back to Edit mode to edit the page.
On publish tier instances on the other hand, catalog page urls should be kept stable to not lose gains on search engine rankings for example. Because of that publish tier instances will not render deep links to specific catalog pages per default. To change this behavior, the CIF URL Provider Specific Page Strategy can be configured to always generate specific page urls.
Custom URL Formats
To provide a custom URL format that a project can implement either the ProductUrlFormat
or the CategoryUrlFormat
service interface and register the implementation as OSGI service. Those implementations, if available, replace the configured, pre-defined format. If there are multiple implementations registered, the one with the higher service ranking replaces the ones with the lower service ranking.
The custom URL format implementations must implement a pair of methods to build a URL from given parameters, and to parse a URL to return the same parameters respectively.
Combine with Sling Mappings
In addition to the UrlProvider
, it is also possible to configure Sling Mappings to rewrite and process URLs. The AEM Archetype project also provides an example configuration to configure some Sling Mappings for port 4503 (publish) and 80 (Dispatcher).
Combine with AEM Dispatcher
URL rewrites can also be achieved by using AEM Dispatcher HTTP server with mod_rewrite
module. The AEM Project Archetype provides a reference AEM Dispatcher config which already includes basic rewrite rules for the generated size.
Example
The Venia Reference store project includes sample configurations to demonstrate the usage of custom URLs for product and category pages. This allows each project to set up individual URL patterns for product and category pages according to their SEO needs. A combination of CIF UrlProvider
and Sling Mappings as described above is used.
hostname.adobeaemcloud.com
folder in ui.content/src/main/content/jcr_root/etc/map.publish/https
according to the used domain name and enable this config by adding resource.resolver.map.location="/etc/map.publish"
to the JcrResourceResolver
config of the project.