Hi All, I need some suggestions. In my website, different pages use different editable templates but they all have a common global navigation added in the templates. This global navigation component is shared by different markets as well. Now I need to update the global nav for a specific market for redesigning purpose. What is the best way to do this without impacting other markets? If I create a new version of the global nav component, is there a way to add the specific version of component in the template depending on the market?
Thanks in advance!
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @aembee ,
I can suggest few options:
1) Conditional logic
<sly data-sly-use.navHelper="${com.pack.NavHelper}"></sly>
<sly data-sly-test="${navHelper.isDefaultNavigation}">
<sly data-sly-include="global-nav-v1.html"/>
</sly>
<sly data-sly-test="${!navHelper.isDefaultNavigation}">
<sly data-sly-include="global-nav-v2.html"/>
</sly>
You can either use CA Configuration for feature toggling or org.apache.sling.featureflags.Feature.
Benefit: This is simple but requires maintaining two versions.
2) Use Experience Fragments (XF) for Market-Specific Navigation
Benefit: Editors can manage navigation per market without code changes.
Best regards,
Kostiantyn Diachenko.
Use Core XF component which support localization.
Another approach to use context-aware-config
Another option could be developing the global navigation component with a Component Policy Configuration Property that allows selecting the desired template layout for different markets.
This approach is similar to how AEM Core Components' Image provides configurable properties like jpegQuality and resizeWidth. By leveraging this technique:
Add a property in the component policy configuration where authors can specify the market-specific version of the navigation.
Based on the policy configuration, the component should dynamically load the appropriate navigation structure or style for the selected market.
Since each template already includes the global navigation, you can configure different policies per template to reflect the correct version for that specific market.
This method ensures that content authors can manage navigation updates seamlessly through template-level configurations rather than requiring separate component versions for each market.
This method ensures that content authors can manage navigation updates seamlessly through template-level configurations rather than requiring separate component versions for each market.
Experience Fragment with localization.
Views
Replies
Total Likes
Views
Likes
Replies