Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.
Step 2: Create a Sitemap.cfm Page
In order to build a dynamic sitemap that replicates the above xml file we simply rename sitemap xml to sitemap.cfm and add the follow two processing directives to the head of the file. These tell coldfusion to serve the file using the utf-8 encoding standard and to only output code that is wrapped in the cfoutput tags. We finally wrap our previous code with cfoutput tags so that the contents of the file are displayed.
Note: It is very important that you leave no spaces between the opening cfoutput tag and the xml declaration as any whitespace before the xml declaration invalidates the file.
<cfsetting enablecfoutputonly="true" showdebugoutput="false">
<cfoutput><?xml version="1.0" encoding="UTF-8"?>
We test that this is working by visiting "http://oursite/sitemap.cfm/" .If we get back an xml document then we are good to continue on to the next step.