Editable template association with Policies | Community
Skip to main content
rawvarun
Community Advisor
Community Advisor
November 23, 2017
Solved

Editable template association with Policies

  • November 23, 2017
  • 9 replies
  • 6931 views

For the static template, the design is stored at /etc/designs/<my-site>/jcr:content/<page-component-name>/<component-name> (if the page has a design path of /etc/designs/<my-site>) or/etc/designs/default/jcr:content/<page-component-name>/<component-name>

For editable template, design is stored at /conf/<your-project>/settings/wcm/policies.

So, In case of editable templates,only one template specific configuration(i.e. policies) per template can be there.

But, it is not the case with the static template, where more than one template-specific configurations (i.e. provide one separate design) can be associated with the template.

Template Name

Static Template

Editable Template

Design

T1/etc/designs/<site-name>/fr/jcr:content/landingpage/conf/<project-name>/settings/wcm/policies/t1/etc/design/<project-name>/fr
T1/etc/designs/<site-name>/us/jcr:content/landingpage/conf/<project-name>/settings/wcm/policies/t1/etc/design/<project-name>/us

How the above use case can be solved for the Editable template, wherein I want more than 1 policies (or config)  per template depending on the designs.

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

When you create an editable template directory. You create a scope for templating. There, you will have a local list of policies. One can create as many policies as they want. Content Policies are meant to be reusable and portable. The content policy mechanism is leveraging the Conf Manager. This means that the policies can be located at many different places such as follows:

  • /conf/<my-template-folder>/settings/wcm/policies (project level)
  • /conf/global/settings/wcm/policies (global level)
  • /apps/settings/wcm/policies (customer level)
  • /libs/settings/wcm/policies (AEM Private level)

To have access to all the policies located under the previous paths at once, one must set the merge list property on the jcr:content under the local policies node such as:

/conf/<my-template-folder>/settings/wcm/policies/jcr:content/mergeList{Boolean}=true

tl;dr

The merging logic of the Conf Manager is as follows:

  1. going from the most unspecific config to the most specific
  2. start with the original set (list)
  3. then for each set (same config item name) from the different configs
  4. look at the currently merged set (a) and the next one (b), item by item
  5. and decide what happens with the item, based on its node/page name:
    1. new item in (b) will be added to the set (a)
    2. existing item (a) will be replaced by same name item (b) if that one has a jcr:content child
    3. existing item (a) will get removed if there is a same name item in (b) without any jcr:content child

9 replies

smacdonald2008
Level 10
November 23, 2017

For information in this subject - see the AEM docs here:

Page Templates - Editable

rawvarun
Community Advisor
rawvarunCommunity AdvisorAuthor
Community Advisor
November 24, 2017

Hi smacdonald2008 ,

The Page Templates - Editableoes not tell how we solve this issue.

Regards,

Varun Rawat

smacdonald2008
Level 10
November 24, 2017

TO clarify - you believe there is missing information from the docs?

smacdonald2008
Level 10
November 24, 2017

We are looking into this as well.

rawvarun
Community Advisor
rawvarunCommunity AdvisorAuthor
Community Advisor
November 27, 2017

smacdonald2008 ,

Let me know when I can get the update on the above.

Patrick_FauchereAdobe EmployeeAccepted solution
Adobe Employee
November 28, 2017

When you create an editable template directory. You create a scope for templating. There, you will have a local list of policies. One can create as many policies as they want. Content Policies are meant to be reusable and portable. The content policy mechanism is leveraging the Conf Manager. This means that the policies can be located at many different places such as follows:

  • /conf/<my-template-folder>/settings/wcm/policies (project level)
  • /conf/global/settings/wcm/policies (global level)
  • /apps/settings/wcm/policies (customer level)
  • /libs/settings/wcm/policies (AEM Private level)

To have access to all the policies located under the previous paths at once, one must set the merge list property on the jcr:content under the local policies node such as:

/conf/<my-template-folder>/settings/wcm/policies/jcr:content/mergeList{Boolean}=true

tl;dr

The merging logic of the Conf Manager is as follows:

  1. going from the most unspecific config to the most specific
  2. start with the original set (list)
  3. then for each set (same config item name) from the different configs
  4. look at the currently merged set (a) and the next one (b), item by item
  5. and decide what happens with the item, based on its node/page name:
    1. new item in (b) will be added to the set (a)
    2. existing item (a) will be replaced by same name item (b) if that one has a jcr:content child
    3. existing item (a) will get removed if there is a same name item in (b) without any jcr:content child
markn78697218
April 3, 2023

Is this accurate?

 

We've tried to merge in policies from `/conf/global/settings/wcm/policies` in our site specific config (`/conf/<site>/settings/wcm/policies`) with `mergeList` set to true on the jcr:content node, and this evidently doesn't work.

 

We've also tried to merge in policies from `/apps/settings/wcm/policies` in our site specific config with `mergeList` set to true. This works initially, but once an author attempts to add a new policy, an exception is thrown and error popup is displayed:

 

        org.apache.sling.api.resource.PersistenceException: Unable to create node at /conf/<site>/settings/wcm/policies/wci/components

 

After the exception is thrown, all policies from `/apps/settings/wcm/policies` are no longer merged into the site's policies.

rawvarun
Community Advisor
rawvarunCommunity AdvisorAuthor
Community Advisor
December 2, 2017

Hi patrickf14763699 ,

Can i associate different policies for the same Template based on different designs?

Adobe Employee
December 4, 2017

Hi rawvarun,

No, the content policy is basically the equivalent of the design. Your are going to have one content policy where you previously had a design node with a static template.

poornimaj866995
November 13, 2018

Based on locations specific site, i want to add a policy to the common template which already has common components.

Can this be done by adding multiple cq:policy be added to the template?