Expand my Community achievements bar.

Setting up defult page property for pages created from specific template

Avatar

Level 3

Hi,
I have a template, which has a custom boolean property hideBreadcrumb checked by admin. Now, I'm creating new pages using template programatically. I want all the pages created from template to have hideBreadcrumb property checked by default. Do I need to add any configuration for this? My template property is currently checked but pages created from the template don't have hideBreadcrumb checked. Thanks in advance!

4 Replies

Avatar

Community Advisor

@prachiz :

if you make any changes to the existing template(adding any property or value) , that will applicable for the pages we create later.

same will not affect on the existing pages. so you can do any of the below.

 

1) if you need to check that property programmatically , in your logic try to check that property, if property doesn't exist , treat that as by default true.

2) if you need that value has to be present at the page level , then you can update that property programmatically by developing Sling servlet or Groovy script .

(Query out all the pages which are created by template , and try to iterate and add the property.)

 

Thanks,

Siva

Thanks,
Siva

Avatar

Community Advisor

@prachiz - If your template is an Editable Template, then the custom property can be defined as template level configuration. The policies will all end up residing in a single .content.xml file.

 

Please refer to the below documentation link -

https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/templates/page-tem...

 

Rohan_Garg_0-1678763501529.png

 

You can also refer to the below blog for the same -

https://www.hoodoo.digital/blog/organizing-content-policies-in-aem

Avatar

Level 3

Thanks Everyone! I noticed one thing. If I create the new pages manually using same template, hideBreadcrumb property is checked but if the pages are created programatically from JAVA, hideBreadcrumb is not checked by default, although template has that property checked.