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
BedrockMission!

Learn More

View all

Sign in to view all badges

How to wrap 2 components in a div from the template content.xml file? | AEM Community Blog Seeding

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,159 likes

Total Posts

6,255 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,159 likes

Total Posts

6,255 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

26-05-2020

BlogImage.jpg

How to wrap 2 components in a div from the template content.xml file? by howtoaem Blog

Abstract

How to get url of all child,grand child pages using root path?
I have a path of a root page and I want to retrieve all the child pages of root page and grandchild and grandchild of root page. My structure is like this
rootPage
|
|
|---------childPage
|
|
|---------grandChildPage
|
|
|
|----------------------grandGrandChildPages

So I want the path of all these pages. How can I get this? currently, I'm using this
adminSession = repository.loginAdministrative( repository.getDefaultWorkspace());
ResourceResolver resourceResolver = request.getResourceResolver();
PageManager pageManager = resourceResolver.adaptTo(PageManager.class);
ListpageList = new ArrayList();
Page rootPage = pageManager.getPage("/content/abc/roi");
Iterator rootPageIterator = rootPage.listChildren();
while(rootPageIterator.hasNext())
{
Page childPage = rootPageIterator.next();
String path = childPage.getPath();
pageList.add(path);
}

But it provides me the only the child pages of root page and if I use rootPage.hasChild() then I have to pass the string which I can't because I don't know the name of pages. Is there any method which returns boolean value whether a page has child pages or not. I just want a list of all pages inside the root page which include grandChild as well as grandgrandCHild of root page.

Read Full Blog

How to wrap 2 components in a div from the template content.xml file?

Q&A

Please use this thread to ask the related questions.

AEM AEMEBlogSeeding Experience Manager