Expand my Community achievements bar.

Context-Aware Absolute Parents strategy

Avatar

Level 2

Hi,

I'm using Context-Aware configurations with WCM.IO Context Aware extensions allowing me to define configs under /content node as configuration pages.

Assuming a following structure:

 

Configuration pages:

/content/site/en/configuration

/content/site/fr/configuration

 

It it possible with absolute parents strategy to look for those specific configuration pages in parents node eg. from /content/site/en/home or /content/site/fr/home?
Now it works for me only when configuration page is direct parent of child page eg. /content/site/en/configuration/home.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

4 Replies

Avatar

Community Advisor

I think you should check the configuration, the absolute paths mapping are done in a configuration 

io.wcm.caconfig.extensions.contextpath.impl.RootTemplateContextPathStrategy

Example, here you can update the regex

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
          xmlns:jcr="http://www.jcp.org/jcr/1.0"
          jcr:primaryType="sling:OsgiConfig"
          templatePaths="[/apps/*/templates/*]"
          minLevel="0"
          maxLevel="4"
          contextPathRegex="^/content(/.+)$"
          configPathPatterns="[/conf$1]"
/>

 

 



Arun Patidar

Avatar

Level 2

But this particular strategy is different than I mentioned I use.

Avatar

Community Advisor

Hello @MikołajBuda 

 

Requesting you to please cross-check, if the

- sling:configRef is set properly on the site

- Also, if the sling:configs are being created on right location

https://www.oshyn.com/blog/context-aware-configurations-aem

https://sunsushil.wordpress.com/2021/05/12/context-aware-configuration-in-aem/


Aanchal Sikka

Avatar

Level 2

- With Absolute Parents strategy there is no need for sling:configRef to be set. That's why I use it.

- Yes, they are as they are properly resolved when pages are under configuration page node. But in real world scenario we don't want to create pages under configuration node so it's not resolved with Absolute Parent strategy. That's why I seek for other solution. Basically I look for possibility to detect configuration node which is in parent node but not as direct parent. I could write a custom code to resolve but I don't believe there isn't already something OOTB.