Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Template Senarios

Avatar

Level 2

If I have two templates A and B whenever I create a page under template A but it should always use template B how should I achieve that? 

1 Accepted Solution

Avatar

Correct answer by
Level 8

You can use cq:allowedTemplates  property to allow specific templates to be visible under a path. 

You can set this property on /conf/project/settings/wcm/templates/template-a/initial/jcr:content of the Template A. So once the author creates a page using Template A, the page will have Template B as cq:allowedTemplates property and Authors can choose only Template B to create a page under it.

 

Reference  : /content/we-retail/jcr:content

sachinarora_0-1658492306715.png

 

 

View solution in original post

0 Replies

Avatar

Employee

Its quite a strange use case. Are both templates identical ? 

Avatar

Correct answer by
Level 8

You can use cq:allowedTemplates  property to allow specific templates to be visible under a path. 

You can set this property on /conf/project/settings/wcm/templates/template-a/initial/jcr:content of the Template A. So once the author creates a page using Template A, the page will have Template B as cq:allowedTemplates property and Authors can choose only Template B to create a page under it.

 

Reference  : /content/we-retail/jcr:content

sachinarora_0-1658492306715.png

 

 

Avatar

Level 3

You can use cq:allowedTemplates property to define specific templates. Set property in a way that only Template B is available for use.

Avatar

Community Advisor

Hi,

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

 

These properties allows you to set some contract of structure of pages in you project. For example: you have 3 templates (and corresponding pages with this templates):

  • template-1: allowedChildren="[template-2]"
  • template-2: allowedChildren="[template-3]"
  • template-3: allowedChildren="[]"

Then in siteadmin, you will be able to create:

  • under page with template "template-1" only pages with template "template-2",
  • under page with template "template-2" only pages with template "template-3",
  • under page with template "template-3" you will not be able to create any page.