My most-recent post talked about how you can utilize the Sitecore Sitemap XML module in order to automatically build robots.txt and XML sitemap files in a mulit-site, hardened environment so that the search engines can see your sitemap(s). This works great, but a new issue arises if you have separate Content Managment (CM) and Content Delivery (CD) servers.
The Problem
When your content is published, the Sitemap XML module waits for the "publish:end" event to start building the robots.txt and XML sitemap(s). It does so and stores the files in the file system. The issue with this is that the processing and creation of files all happens on the CM server, which is behind a firewall. The CD servers are the web-facing servers that will be serving the sitemap and robots.txt files. We need the files on the CD servers.The Solution
I went through a number of iterations in my head about how I could get the robots.txt and XML sitemap files to the CD servers. I thought about scheduled jobs in Sitecore. I thought about using an external application that is used for file replication. I thought about a custom application inside of Sitecore so that a content author could manually kick off a deploy.
After running some of these ideas by a fellow Arke employee and Sitecore MVP, Andy Uzick, I came to realize that I was over thinking my solution by far. This sort of problem had been solved long ago and is *WAY* simpler than I had originally thought.
The solution is to change the "SitemapXML.config" to subscribe to the "publish:end:remote" event instead of the "publish:end" event. This event fires after a successful publish and let's remote servers perform the actions specified. In our case, this lets the SitemapXML module know to build the robots.txt and sitemap(s) files. Just ensure that you have the SitemapXML.DLL and SitemapXML.config files present on all your CD servers and you're good-to-go!
Very simple solution and now I don't have to manually copy files between servers!
After running some of these ideas by a fellow Arke employee and Sitecore MVP, Andy Uzick, I came to realize that I was over thinking my solution by far. This sort of problem had been solved long ago and is *WAY* simpler than I had originally thought.
The solution is to change the "SitemapXML.config" to subscribe to the "publish:end:remote" event instead of the "publish:end" event. This event fires after a successful publish and let's remote servers perform the actions specified. In our case, this lets the SitemapXML module know to build the robots.txt and sitemap(s) files. Just ensure that you have the SitemapXML.DLL and SitemapXML.config files present on all your CD servers and you're good-to-go!
Very simple solution and now I don't have to manually copy files between servers!