Blogs > SiteMap Implementation in AEM

AEM Sites

SiteMap Implementation in AEM

Infodales Tech Solutions | December 12, 2024

What is a sitemap ?

In AEM (Adobe Experience Manager), a sitemap is a structured XML file that lists the URLs of a website to help search engines like Google and Bing crawl and index the content efficiently. AEM provides multiple ways to generate and manage sitemaps, including sitemap.xml for search engines and HTML sitemaps for users. .

Why Are Sitemaps Important?

  • Better SEO (Search Engine Optimization) – Helps search engines find and index content faster.

  • Improves Website Crawling – Ensures all important pages are discovered, even those not well-linked.

  • Enhances User Experience – HTML sitemaps help users navigate large websites easily.

  • Supports Multiple Content Types – Video, images, news, and e-commerce sites benefit from specialized sitemaps.

XML Sitemap (For Search Engines)

  • Used primarily by search engines like Google, Bing, and Yahoo.

  • Helps search engines crawl and index the website efficiently.

  • Enhances User Experience – HTML sitemaps help users navigate large websites easily.

  • For e.g we have the url for google ,https://www.google.com/sitemap.xml

  • google-sitemap-image

    Similarly we can create the site map for our site created on AEM.

How to implement Sitemap on Author Instance

  • Navigate to http://localhost:4502/system/console/configMgr.

  • Search for the org.apache.sling.sitemap.impl.SitemapGeneratorManagerImpl

  • Checked on All on-demand checkbox.

  • Save the changes

  • sitemap-generator-image
  • Checking on All on Demand will allow you to create the sitemap .

  • Note : allOnDemand configuration is having a drawback as it processes data and generates a sitemap everytime we hit the URL to generate a sitemap.

  • Similarly search for PageTreeSitemapGeneratorImpl in config manager.

  • This configuration allows you to add the last modified date and also will represent data in xml format.

  • page-tre--sitemap-generator-image
  • Navigate to http://localhost:4502/sites.html/content open page properties , on Advanced check the Generated Sitemap check box.

  • Now on the browser hit this url http://localhost:4502/content/sample.sitemap.xml.

  •                                 
    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    
    
    /content/sample.html
    2019-02-11T17:34:23.056Z
    
    
    /content/sample/en.html
    2024-03-27T17:17:13.153Z
    
    
    /content/sample/en/contact-us.html
    2020-02-06T17:29:33.318Z
    
    
    /content/sample/en/faq.html
    2021-01-26T20:47:39.275Z
    
    
    /content/sample/en/faq/who-is-csa.html
    2022-05-25T20:13:01.403Z
    
    
    /content/sample/en/faq/do-i-need-travel-protection.html
    2022-05-25T19:44:14.081Z
    
    
    /content/sample/en/faq/when-can-i-buy-travel-protection-.html
    2019-03-13T17:05:47.527Z
    
    
    /content/sample/en/faq/when-does-coverage-begin.html
    2019-03-13T17:07:39.002Z
    
    
    /content/sample/en/faq/maximum-trip-length.html
    2019-03-13T17:08:54.688Z
    
    
    /content/sample/en/faq/can-my-traveling-companions-and-i-be-insured-on-the-same-plan-.html
    2019-03-13T17:09:55.142Z
    
    
                                    
                                

    Similarly you can create SiteMap on publish instances too.

    Dispatcher Configuration for SiteMap

    • Include the following entry in the dispatcher/src/conf.dispatcher.d/filters/filters.any file.

    •                                         
                                                  /0201 { /type "allow" /path "/content/*" /selectors '(sitemap-index|sitemap)' /extension "xml" }
                                              
                                          
    • Include the .xml extension in the rewrite rules within the dispatcher/src/conf.d/rewrites/rewrite.rules file.

    •                                         
                                                  RewriteCond %{REQUEST_URI} (.html|.jpe?g|.webp|.svg|.xml)$
      
                                              
                                          

Yash Sakharkar | AEM Developer
LinkedIn Email