Expand my Community achievements bar.

Apache Sling Sitemap in AEM 6.5 & AEMaaCS | AEM Community Blog Seeding

Avatar

Administrator

11/30/21

BlogImage.jpg

Apache Sling Sitemap in AEM 6.5 & AEMaaCS by The AEM Maven - Juan Ayala

Abstract

On almost every AEM project I've worked on, there has been a need to generate a Google sitemap. It is standard SEO practice. The first time I wrote one using JSP and a resource visitor. In the last couple of projects, I used the ACS Commons Sitemap Generator.


Recently I came to find out that the ACS generator is now deprecated. Its recommended replacement is the AEM WCM Core Components Sitemap feature. That is on AEMaaCS. For 6.5.10.0 and below, there is no such feature. That is until now with the release of 6.5.11.0.


This one feature is no reason to rush to upgrade. It is something to keep in mind should you find yourself working with that version. And definitely, if you are working on AEMaaCS.


The video on the tutorial page covers the configuration. You will generate sitemaps in no time. I will sum up those steps here. What that video does not cover is customization. Skip to the end if that is what you are looking for.


Prerequisites

If you are on AEM 6.5, make sure you have service pack 11 or greater. Once you have that, you will also need the SEO Index Package from the Software Distribution site. That is an oak:index definition that will index the sling:sitemapRoot property.


If you are on AEMaaCS, you are ready to go.


Setting Up on Author

I set up a new 6.5.11.0 instance and generated a project with the Maven archetype. You will need to do two things on the author instance


Configure the Apache Sling Sitemap - Sitemap Generator Manager to work on-demand. Create the file org.apache.sling.sitemap.impl.SitemapGeneratorManagerImpl.cfg.json in the config.author runmode folder

{
"allOnDemand": true
}
And set the page property sling:sitemapRoot to true on your target root i.e. /content/mysite/us. That's it! Access http://localhost:4502/content/mysite/us.sitemap.xml and you have finished. Having the on-demand option is a good way to debug and preview.

Read Full Blog

Apache Sling Sitemap in AEM 6.5 & AEMaaCS

Q&A

Please use this thread to ask the related questions.