Sitecore is by far the best content management system (CMS) with which I've had the pleasure of implementing. My colleagues and I have sat around the table on numerous occasions talking about how well put together it seems to be. As we've proceeded to become more comfortable with the tool set we have discovered however, that what seems to be missing occasionally is detailed guidance for scaled environments with respect to the numerous modules available. Such is the case with the Sitecore Sitemap Shared Source module.
EVENTS AND HANDLERS
Sitecore uses a very sophisticated eventing model that allows for plug-and-play like configuration for handling system events. When events are raised Sitecore inspects the event configuration and passes the events to every configured "handler". Quite simply, a handler is a .NET class with a default constructor and methods that are configured for the processor to call when the event is raised. As an example, the publish:end event fires at the end of publishing. The default Sitecore configuration for publish:end is to clear the caches so the newly published content can be reloaded. For a single server environment, publish is all handled locally. Challenges arise however, when the environment is scaled out. Publishing effectively becomes a remote event on the target delivery server(s).
SCALED OUT ENVIRONMENTS
In a small Sitecore farm, the content management (authoring) sub-system is typically installed on one ore more servers and content delivery is installed on another set of servers. This configuration allows authoring to be isolated and protected. Following the scaling guidance is enough to get the authoring environment to remotely publish to delivery and to evict the delivery caches on publish end.
Sitecore provides for this using remote publishing. Events are pushed to the remote servers and are processed on a timed schedule. Publish:end fires on the publishing server and publish:end:remote then fires on the target servers. It stands to reason then that documentation for add-on modules should cover configuration for scaled environments. The Sitemap Shared Source module is one of those add-ons that falls short when documenting how to configure it for scaled out environments.
The sitemap module does a great job of creating an xml sitemap (for use with robots and search sites) and can normalize your urls as well. Out of the box, the sitemap module is configured to fire on publish:end. When publish:end event fires, the sitemap module refreshes the sitemap(s) that are configured to be processed, then inspects a configuration key to determine if the environment is a production envionment. When that setting is set to true, the sitemap module submits requests to all the configured search engines to recrawl the site.
In the event that delivery is scaled out, the sitemap module's default configuration doesn't support refreshing the sitemap or submitting to search engines.
<> timingLevel="custom"> <> name="publish:end"> <> type="Sitecore.Modules.SitemapXML.SitemapHandler, Sitemap.XML" method="RefreshSitemap" /> > >
To enable sitemap refresh to occur on your delivery servers you need to make sure the SitemapXml configuration file includes the refresh sitemap handler in the publish:end:remote event.
<> timingLevel="custom"> <> name="publish:end:remote"> <> type="Sitecore.Modules.SitemapXML.SitemapHandler, Sitemap.XML" method="RefreshSitemap" /> > >
Before enabling scaling read the latest scaling guidance. At the time of this writing it can be found here.
To take advantage of the Sitemap XML Module in a scaled out environment, configure the content management server's Sitemap XML settings as your non-production server and ensure that all site nodes are removed. Next you will want to configure each of your delivery severs as production and change the publish:end patch in the sitemap xml configuration file to publish:end:remote. When publish ends, your remote servers will be notified via remote event publishing and the Sitemap XML module will rebuild the sitemap and robots file for you then submit the necessary requests to the search engines for the delivery domain.