Expand my Community achievements bar.

SOLVED

Allowed templates for editable templates

Avatar

Level 3

Hello everyone,

 

I have following scenario:

 

Here my templates configuration

/conf/<mybrand>/settings/wcm

  • template-type:
    • content-consumer-template-type
    • content-business-template-type
    • structure-consumer-template-type
  • template:
    • structure-business-template 
      • cq:allowedTemplates: content-business-templateA
    •  content-business-templateA
      • cq:allowedTemplates: content-business-templateA
    • structure-consumer-template
      • cq:allowedTemplates: content-consumer-templateA
    • content-consumer-templateA
      • cq:allowedTemplates: content-consumer-templateA

 

I created a page "MyStructurePage" with the structure-consumer-template and below it a page "MyContentPageA" with template content-consumer-templateA. Everything works.

 

/content/MyStructurepage/MyContantPageA

 

But now a template editor creates a new editable template "content-consumer-templateB" based on the "content-consumer-template-type". The editor allows the "content-consumer-templateB" template as a template below "structure-consumer-template" and "content-consumer-templateA" via cq:allowedTemplates property. But now below my pages "MyStructurePage" and "MyContentPageA" I can't create a page with template "content-consumer-templateB" because they were already create before the cq:allowedTemplate property was changed. I also can't work with wildcards for the cq:allowedTemplates property because I have to differ between business and consumer template and unfortunately the current structure of template names in my project (not a new setup) haven't a naming convention like in my constructed example.

 

Finally my question is: How to allow new editable templates for already created pages?

 

Thanks for helping me!

 

Andrea

--------

AEM 6.5 SP14

1 Accepted Solution

Avatar

Correct answer by
Level 5

@ajur  -

Template Availability

CAUTION

AEM offers multiple properties to control the templates allowed under Sites. However, combining them can lead to very complex rules that are difficult to track and manage.

Therefore, Adobe recommends that you start simple, by defining:

  • only the cq:allowedTemplates property

  • only on the site root

For an example, see We.Retail: /content/we-retail/jcr:content

The properties allowedPaths, allowedParents, and allowedChildren can also be placed on the templates to define more sophisticated rules. However, when possible, it is much simpler to define further cq:allowedTemplates properties on sub-sections of the site if there is a need to further restrict the allowed templates.

An additional advantage is that the cq:allowedTemplates properties can be updated by an author in the Advanced tab of the Page Properties. The other template properties cannot be updated using the (standard) UI, so would need a developer to maintain the rules and a code deployment for every change.

 

Reference -https://experienceleague.adobe.com/docs/experience-manager-64/developing/platform/templates/template...

  

View solution in original post

3 Replies

Avatar

Level 5

Hi @ajur , I believe you can add the template under Advanced tab of page properties so that the template would be available to create child pages under that. Is this what you are looking for?

srikanthpogula_0-1674053862401.png

Thanks

Srikanth

Avatar

Level 3

Hi Srikanth,

yes, I know this feature. This maps to the property cq:allowedTemplates. But if I use this property I have to allow my newly created template for all pages which are already created. The question was how can I (automatically) allow my new template for a special set of pages.

 

Regards,

Andrea

Avatar

Correct answer by
Level 5

@ajur  -

Template Availability

CAUTION

AEM offers multiple properties to control the templates allowed under Sites. However, combining them can lead to very complex rules that are difficult to track and manage.

Therefore, Adobe recommends that you start simple, by defining:

  • only the cq:allowedTemplates property

  • only on the site root

For an example, see We.Retail: /content/we-retail/jcr:content

The properties allowedPaths, allowedParents, and allowedChildren can also be placed on the templates to define more sophisticated rules. However, when possible, it is much simpler to define further cq:allowedTemplates properties on sub-sections of the site if there is a need to further restrict the allowed templates.

An additional advantage is that the cq:allowedTemplates properties can be updated by an author in the Advanced tab of the Page Properties. The other template properties cannot be updated using the (standard) UI, so would need a developer to maintain the rules and a code deployment for every change.

 

Reference -https://experienceleague.adobe.com/docs/experience-manager-64/developing/platform/templates/template...