Context-Aware Absolute Parents strategy | Community
Skip to main content
October 25, 2023

Context-Aware Absolute Parents strategy

  • October 25, 2023
  • 2 replies
  • 940 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

arunpatidar
Community Advisor
Community Advisor
October 25, 2023

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
October 25, 2023

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

aanchal-sikka
Community Advisor
Community Advisor
October 25, 2023

Hello @mikołajbu3 

 

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
October 25, 2023

- 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.