adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
733 stars 743 forks source link

[Architecture] Consistent and customizable site root detection #62

Open stefanseifert opened 7 years ago

stefanseifert commented 7 years ago

the core components currently implement different (and insufficient) site root detection strategies:

only providing a "start level" parameter is limiting, because when set in the editable template for a structure element it requires all sites starting at the same level. this is not necessarily the case for more complex site setups.

defining the root level as path is even more inflexible - if defined in the template for the structure component this template can only use for exactly one site. if the navigation component is defined as editable in page, the path has to be entered for every page of the site again.

what is required is a strategy to detect the site root which is configured once, and used for all components the same way that requires a site root (and this strategy should be usable for custom components as well).

ACS AEM Commons implements such a feature, but it is insufficient as well because it is not possible to configure different strategies for different tenants or contant areas, and not possible to customize the site root lookup beyond using a regex: https://github.com/Adobe-Consulting-Services/acs-aem-commons/issues/1037

If the Site Root detection would be implemented as an OSGi service it would be possible to provide own strategies (should support multiple strategies to be tenant-aware). Another option is to use Sling Context-Aware Configuration to either lookup the configuration for a site, or directly use the "inner-most" Context-Aware Configuration context path as site root (this is the default strategy used by wcm.io URL Handler.

joerghoh commented 7 years ago

I would generalize the concept and go beyond of "site root". You could introduce the concept of a "Site", where the site root is an essential part of it. I could also contain much more site-specific properties (like domain name, other settings, etc).

In general there should be much more abstraction; at the moment the typical AEM application just consists of a bunch of pages, as the product does not ship with an abstraction which goes beyond the concept of "page". Having such an abstraction (or levels of abstraction) could help a lot in the way how applications are structured and navigation is built.

stefanseifert commented 7 years ago

this is also related to #63

henrykuijpers commented 6 years ago

Very big +1 with @joerghoh 's comment!

I think the (relatively) new CAConfig concept can help out with the solution for these issues! The content policies are a good start, but if they can be backed (or replaced) with CAConfigs... :)

gabrielwalt commented 6 years ago

(CQ-4247365)