We have a custom Sitemap generator class for our site; as we want to control some of the URLs generated in our sitemap.xml for bucketed items. I believe I've patched the Sitemap Generator correctly in the config files:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
      <register patch:instead="register[@serviceType='Sitecore.XA.Feature.SiteMetadata.Sitemap.ISitemapGenerator, Sitecore.XA.Feature.SiteMetadata']" serviceType="Sitecore.XA.Feature.SiteMetadata.Sitemap.ISitemapGenerator, Sitecore.XA.Feature.SiteMetadata"  implementationType="Sitecore.XA.Feature.SiteMetadata.Sitemap.CustomSitemapGenerator, XA.SiteMetaData.Custom" lifetime="Transient"/>

However, I can't seem to trigger regeneration of the sitemap xml file; as it never seems to call our custom generator. I've tried rebuilding the code, reloading sitemap.xml, and republishing everything. Still won't trigger. I've verified the config file has been published to my build directory and is in the compiled Sitecore configuration XML.

How can I get the sitemap.xml to be regenerated for the site?

  • you are able to view the output of /sitemap.xml on your browser ?
    – Abhay Dhar
    Jan 7, 2020 at 6:33
  • try app pool reset once.
    – Abhay Dhar
    Jan 7, 2020 at 6:34

1 Answer 1


SitemapHandler which internally is using ISitemapGenerator is the entry point. It has a virtual GetSitemap method which is looking for an instance of ISitemapGenerator in the DI container. So it should pick up your implementation if you have correctly replaced an instance of ISitemapGenerator in the container. If the above config patch is not working for you try this approach: https://stackoverflow.com/questions/43590769/replace-service-registration-in-asp-net-core-built-in-di-container.

One more thing. The SitemapHandler can cache generated sitemap in memory (HttpRuntime.Cache) or in the file. It depends on the settings (I believe those options are defined on the Settings item in your site). Check if the sitemap is not already generated and is stored in the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.