Currently, we are generating Sitemap.xml on the Publishing end event (publish:end:remote), this event takes some time to complete Publishing and this is causing the slowness. We using the Sitecore 9.0.1 Sitecore instance.

Here scheduler won't work as we need to create .xml on the cd server.

Could you please suggest any best way we can generate a sitemap on the CD server?

2 Answers 2


There are a lot of ways to resolve the Sitemap generation:

  1. You could create a Sitecore Scheduled Task that will go through all the pages under Home node. Each of the page templates could have a include in sitemap checkbox. You can run this job every 4 hours or even daily based on the need. Store the XML generated in Media Library or in the file system.
  2. Another option would be to have a Sitecore Controller Rendering. This would work at runtime, only affect the Sitemap.xml page and might be slow for first time load. Once the XML is generated, you could store it in the IIS cache and have a config setting to clear it every 4 hours.

My recommendation would be the first one.

  • regarding to your first option ,if we create scheduler will work in cm servers only what about cd server ?
    – Reddy
    Jul 26, 2022 at 5:08
  • We have scheduled task implemented that writes xml to sitecore field and publishes it to web database, thus it's available on CD instance too.
    – Kamil C
    Jul 26, 2022 at 20:26
  • Yes, you may also write it to Media Library and publish it as part of the job itself. Then it again it can be available in CD Jul 27, 2022 at 6:49

publish:end:remote event handlers are called asynchronously. Content Management server does not wait for them to complete before publishing is completed.

Maybe you have publish:end event handler as well? which is fired directly at the end of publishing?

I don't think that there is one correct answer to your question - it all depends of number of items, time of sitemap generation, frequency of publishing and other factors.

You should really check though if every publish action your content authors execute is a reason to generate new sitemap.

  • we have publish:end event as well
    – Reddy
    Jul 26, 2022 at 5:10
  • You don't need sitemap on CM server. Get rid of that event
    – Marek Musielak
    Jul 26, 2022 at 6:20

Your Answer

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

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