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?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Once you click on Bindings tab in Groovy console then you will be seeing list of binding variables as shown below -
These are implicit objects , we don't need to create these objects explicitly to use in any script and these are ready to use.
I am using the similar script as given by @Manjunath_K
def rootPagePath = "/content/we-retail/language-masters/en/equipment"; for(int index=0; index < 5; index++){ pageManager.create(rootPagePath,"Debal"+index,"/conf/we-retail/settings/wcm/templates/content-page","Test Page Title"+index); }
After successful execution -
pages were created as shown below -
Executed on AEM 6.5.11. Please try and let us know.
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 :
-Manjunath
Hi @Manjunath_K ,
While running your code I am, getting this error:-
"groovy.lang.MissingPropertyException: No such property: PageManagaer for class: Script1"
Can you please provide any solution for this?
Once you click on Bindings tab in Groovy console then you will be seeing list of binding variables as shown below -
These are implicit objects , we don't need to create these objects explicitly to use in any script and these are ready to use.
I am using the similar script as given by @Manjunath_K
def rootPagePath = "/content/we-retail/language-masters/en/equipment"; for(int index=0; index < 5; index++){ pageManager.create(rootPagePath,"Debal"+index,"/conf/we-retail/settings/wcm/templates/content-page","Test Page Title"+index); }
After successful execution -
pages were created as shown below -
Executed on AEM 6.5.11. Please try and let us know.
Views
Likes
Replies