Expand my Community achievements bar.

SOLVED

Best way to managing policies?

Avatar

Level 2

Hi,

 

Is there a way to edit policies and assign them to all instances of a component within a site?  For instance, I want all teasers on my site, regardless of where they are placed or page they are used in to share the same policy settings.

 

I am trying to follow this strategy:

  • Page templates have a baked in header/footer and an unlocked Container.  This container is set to the Page Main policy.
    • Page Main renders a <main> tag, and the only components allowed inside are Containers.
  • The containers that are placed inside of the Page Main container receive the Dynamic Container Policy
    • Dynamic Container Policy allows for all core components, renders as a section element, is set to Responsive Grid and has a fixed set of background colors and style variations that can be applied.

This allows me to "force" the content author into using the Container element on pages to break them up into logical chunks of content. The design matches this strategy, and we use the <section> element to control vertical spacing between chunks of content on the page. The problem I am facing is that I cannot edit the policies on the other core components because they are not directly allowed in the Page Main policy, and I want the Core Components to all share the same configuration across the site.

 

Is there any way to open up a policy editor and have policies applied at the component level?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hey @jdylanmc ,

 

It's not advisable to change policies on core components. However, there is a way you can save policies for those core components in your project. In fact, I implemented once a case like this.

 

Step 1: Don't directly use core components, use proxy components from your project pointing to core components.

  • Proxy Components refer to a Core Component as their super-type.
  • Proxy Components follow the path  : /apps/my-site/components (Where core components path : core/wcm/components)

Step 2: Include these components into your template using editable templates policies.

  • cq:policy
    String
    my-site/components/structure/page/policy

     

  • keep above policies here to reflect your project policies /conf/my-site/settings/wcm/template-types/page/policies/jcr:content

Step 3: Create Templates using above template time & you will see your site components included there.

Step 4: Use AEM OOTB Style Editor to select predefined styles from polices and re-use them across!

 

Hope this helps,

Aditya.Ch

Thanks,

Aditya Chabuku

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hey @jdylanmc ,

 

It's not advisable to change policies on core components. However, there is a way you can save policies for those core components in your project. In fact, I implemented once a case like this.

 

Step 1: Don't directly use core components, use proxy components from your project pointing to core components.

  • Proxy Components refer to a Core Component as their super-type.
  • Proxy Components follow the path  : /apps/my-site/components (Where core components path : core/wcm/components)

Step 2: Include these components into your template using editable templates policies.

  • cq:policy
    String
    my-site/components/structure/page/policy

     

  • keep above policies here to reflect your project policies /conf/my-site/settings/wcm/template-types/page/policies/jcr:content

Step 3: Create Templates using above template time & you will see your site components included there.

Step 4: Use AEM OOTB Style Editor to select predefined styles from polices and re-use them across!

 

Hope this helps,

Aditya.Ch

Thanks,

Aditya Chabuku