Expand my Community achievements bar.

How to create sitemap.html in AEM 6.5

Avatar

Level 1

I have one requirement to create the sitemap.html page for the website. eg.

VaibhavCh9_0-1723184615098.png

 

similar to this site. we need to create a page which will contains the page title and link. the sitemap will contain level 1 and level 2 pages of the sites.

4 Replies

Avatar

Level 3

Hi Vaibhabv,

 

if i understood correctly, you wanted to render parent and it's children pages along with their titles, links.

did you check this - https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-assets/how-to-get-the-list...

update -

or else you shall try something like this

Node parentNode = session.getNode("/content/your/parent/node"); // Get the parent node
NodeIterator children = parentNode.getNodes(); // Get immediate children

// Iterate through immediate children
while (children.hasNext()) {
    Node childNode = children.nextNode();
    // Process child node
    
    // Iterate through children of childNode (second level)
    NodeIterator grandchildren = childNode.getNodes();
    while (grandchildren.hasNext()) {
        Node grandchildNode = grandchildren.nextNode();
        // Process grandchild node
    }
}

Avatar

Level 1

HI @Rajumuddana ,
We might require to exclude few pages like error, thank you screens, etc.

 

so how we can do it, any idea

or any idea is there any core component that we can use to render sitemap.html with links 

Avatar

Level 5

Hi @VaibhavCh9 ,

 

To exclude certain pages from the sitemap you can add an option on page properties - a checkbox to exclude such pages from showing in sitemap.html. While iterating the page nodes, you need to exclude pages with this checkbox enabled. 

 

Regards,

Hemalatha C