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

Learn more

View all

Sign in to view all badges

How can I create a groovy script to add pages under a node using same template?

Level 2
Level 2

Using one of my editable template, is there any way where I can create n-number of pages using any groovy script or any other script? 

AEM content groovy page
1 Reply
Community Advisor
Community Advisor

Hi @zameer_abbas 

You can create pages under specific rootPath using editable templates by below mentioned groovy script.


def rootPagePath = "/content/we-retail/us/en/equipment/";
PageManager pageManager = resourceResolver.adaptTo(PageManager.class);

for(int index=0; index < 5; index++){
pageManager.create(rootPagePath,"test"+index,"/conf/we-retail/settings/wcm/templates/content-page","Test Page Title"+index);



Groovy console successful execution of code :




Pages created after executing script :