Customizing AEM's OOTB Sitemap to include new attributes in AEMaaCs | Community
Skip to main content
Level 4
February 23, 2022
Solved

Customizing AEM's OOTB Sitemap to include new attributes in AEMaaCs

  • February 23, 2022
  • 1 reply
  • 834 views

We have custimized the AEM's OOTB sitemap by creating new service by extending the ResourceTreeSiteMapGenerator and 

overriding addResource() method there. In that service method, I am able to successfully modify the URL and lastModified values. But I have additional requirements to add new attributes in the sitemap (highlighted in blue color). I found that, there is no direct way to do that in the service. I think we can do builder-like API support for these custom extensions which is like creating a few interfaces and classes (just to include a few attributes there). Can somebody confirm if there is any other way?

 

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
 
<url>
   
<loc>http://www.xyz.org/abc/a1.html</loc>
   
<data:news>
   
<news:author>
     
<news:title>The Example Times</news:name>
     
<news:language>en</news:language>
   
</news:author>
  </data:news>

 
</url>
</urlset>

 

@8220494(service = SitemapGenerator.class)
@ServiceRanking(100)
public class NewsSiteMap extends ResourceTreeSitemapGenerator {
 
 @9944223
    protected void addResource(final String name, final Sitemap sitemap, final Resource resource)
            throws
            SitemapException {
 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Anish-Sinha

hi @karanmahi , you are right, there is no ootb configuration available for the sitemap service to modify the sitemap as you have mentioned above. To achieve this, you have to add your own logic in the extended class and use builder API to for the content.

1 reply

Anish-Sinha
Adobe Employee
Anish-SinhaAdobe EmployeeAccepted solution
Adobe Employee
February 28, 2022

hi @karanmahi , you are right, there is no ootb configuration available for the sitemap service to modify the sitemap as you have mentioned above. To achieve this, you have to add your own logic in the extended class and use builder API to for the content.