Expand my Community achievements bar.

How to create custom Sitemap url's on AEM 6.5 ?

Avatar

Level 4

While working a website on AEM 6.5 (SP 6.5.19) ,

We have the default Sitemap working as https://domain.com/sitemap.xml

 

A requirement was to create custom sitemap url's and not the default ones as:

https://domain.com/sitemap-cards.xml (show all pages from the path https://domain.com/cards.html )

and

https://domain.com/sitemap-resources.xml  (show all pages from the path https://domain.com/resources.html )

 

How can we do this? May be not a sitemap but create a separate page/component and render output as xml?

 

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Community Advisor

@surenk - Have you checked video on this page https://experienceleague.adobe.com/en/docs/experience-manager-learn/sites/seo/sitemaps which defines setting sitemap at different paths? This can be done using AEM's OOTB sitemap generator and as mentioned here https://github.com/apache/sling-org-apache-sling-sitemap?tab=readme-ov-file#content-model you need to set sling:sitemapRoot = true for /cards and /resources pages from page properties.

By using AEM OOTB's sitemap, you adhere to sitemap's schema and it takes care of generating the index files which will be used by search engines.

If you have enabled sling:sitemapRoot = true on 
/content/project/us
/content/project/us/cards
/content/project/us/resources

Now when you open index file https://domain.com/content/project/us.sitemap-index.xml it will give you something like this

<sitemap>
  https://domain.com/content/project/us.sitemap.xml
</sitemap>
<sitemap>
  https://domain.com/content/project/us.sitemap.cards-sitemap.xml
</sitemap>
<sitemap>
  https://domain.com/content/project/us.sitemap.resources-sitemap.xml
</sitemap>

 

If the sitemap urls e.g. https://domain.com/content/project/us.sitemap.cards-sitemap.xml doesn't meet your need, you can see if you can rewrite the urls based on some logic.

If this still doesn't work then you can go for custom sitemap generater based on your own logic in AEM as briefly described here https://www.albinsblog.com/2017/03/how-to-generate-sitemap-for-multi-site-environments-cq5-aem.html

Avatar

Community Advisor

Hi, 

You have a good explanation of how this works, and even an example of how to customize (create your own) sitemap based in your requirements in this article: https://www.theaemmaven.com/post/aem-apache-sling-sitemap 

 

Hope this helps



Esteban Bustamante