adobe / aem-cif-project-archetype

Maven template to create new CIF Project AEM projects that follow best practices
Apache License 2.0
20 stars 12 forks source link

CIF-1256 - Better customizable PLP/PDP URL generation #100

Closed cjelger closed 4 years ago

cjelger commented 4 years ago

Description

This PR configures an example UrlProvider service and the corresponding Sling Mappings for an AEM publish instance on ports 4503 or 80 (that is, when accessed via Dispatcher). Note that the Sling Mappings are created in /etc/map.publish to void that they are activated by default on author or publish instances. To activate them on a publish instance, one simply needs to rename the folder to /etc/map (it's also possible to configure /etc/map.publish in the "Apache Sling Resource Resolver Factory" AEM config but this triggers an avalanche of service restarts ...).

This configures the Venia sample website to generate the following links WITHOUT and WITH Sling Mappings.

Product pages /content/venia/us/en/products/product-page.zing-jump-rope.html vs. /us/en/zing-jump-rope.html

Category pages /content/venia/us/en/products/category-page.5.html/gear/fitness-equipment vs. /us/en/gear/fitness-equipment.5.html

It's an example configuration to demonstrate how the UrlProvider and the Sling Mappings can be used to configure SEO-friendly pages. The documentation will be added to the Core Components wiki page.

How Has This Been Tested?

Manually tested + unit tests in the CIF components repo.

Types of changes

Checklist:

mhaack commented 4 years ago

For the mapping config, I suggest we keep/content/venia in the path to be consistent also with other pages and only optimize PDP/PLP URLs part after /content/venia/us/en. That way we can still demonstrate the functionality and full rewriting config can be done/adjusted by projects also in sync with Dispatcher config.

Removing /content/venia also can break dispatcher invalidation because publish instance will trigger invalidation request to Dispatcher with the page path including /content/venia, pages cached in /us/en/... folders will not be invalidated.

cjelger commented 4 years ago

@mhaack I added content/venia everywhere, you're right, it would be more consistent.

mhaack commented 4 years ago

👍 LGTM