Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!
SOLVED

Automating Page Generation in AEM

Avatar

Level 1

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 ?

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi,

 

It depends on how you want to create,i have put down in simple way here.

 

1.you 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.

3.you 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.

6.you 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.

 

View solution in original post

6 Replies

Avatar

Level 3

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

Avatar

Level 1
Thanks for the response. Appreciate if you could explain little details on this, like what are the pre-requisites etc ?

Avatar

Correct answer by
Level 3

Hi,

 

It depends on how you want to create,i have put down in simple way here.

 

1.you 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.

3.you 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.

6.you 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.

 

Avatar

Level 3
Thanks for the detailed explanation. Good that you mentioned that we are sure this is a one time activity and also this servlet isn't functioning in Publish.

Avatar

Community Advisor

@wasimzen,

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!