Automating Page Generation in AEM



Here is my use case,


I have thousand text article content

I need to create pages with same structure and layout for these 1000 articles

I don't want to create each page manually

How do I automate creating those 1000 pages ?

Accepted Solutions (1)

Accepted Solutions (1)





It depends on how you want to create,i have put down in simple way here. first create a template for your article page -  as you know the layout .

2. Feed you articles data through excel or xml or any structured format. can even have this file uploaded in dam

4.write a servlet which can read data from this excel and create pages.

5. Pagemanager api helps you to create pages . ( as suggested by @ruchim71073425  ) & update components after page is created. can hit this servlet in browser, to create pages.


Note :  I hope this is one time creation of articles , you can run in batches rather than creating 1000 articles in one go.


Answers (2)

Answers (2)



You can use the Page Manager API to create pages programmatically.





One other way is to create a Sling Servlet in AEM where it accepts a JSON object (by file upload). The Servlet will accept a POST request, where you can use a JSON parser in JAVA (like the Jackson Object Mapper) to parse the JSON Object; or other file format of your choice, but you need to select a correct parser.

The servlet will programmatically create cq:Page nodes as required (how to create cq:Page programmatically) using the PageManager OR you can create a generic page with pre-configured components in AEM first, then use the PageManager to copy the generic page, and update properties and components for that given page.

Note: Migrate pages by batches, try to categories each migration by the unique templates.

After pages are created, you create a content package to deploy to live environments.

I hope this helps!