ACS provides a comprehensive coverage on sitemap.xml generation. It also takes care alias names (for multi lingual pages with local page names).
Sitemap Generator
https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/adobe/acs/commons/wcm/impl/SiteMapServlet.java
OR
it is fairy easy if you want to generate a simple xml out of given hierarchy and exclude some of pages/directory. iterate all the pages recursively and Use Javax.xml API to generate XML. Make sure you have check to exclude list of pages.
One last thing, you should be creating sitemap.xml file under language page (e.g. en, fr).
In this whole process, i don't see point of creating followings:
- Index.html page
- Managing page properties checkbox to exclude a page from sitemap. Because that is overhead. Just OSGI configuration should be fine.
- Robots.txt is different than sitemap. we should be creating robots.txt separately.
Source:- What are the best ways to implement a sitemap?
External article:- https://www.techaspect.com/blog/generating-sitemaps-using-adobe-experience-manager/
-Kautuk