Site icon Search Engine People Blog

ColdFusion code to create Google Sitemaps

Below is some ColdFusion code which will create the output for the new Google Sitemap program. It assumes you have already created a text file with a list of urls that you want included in the sitemap (one url on each line). Simply change the path in the two cffile tags to point to your original text file's location as well as the location of the xml file that will be generated. Then just run the script (can only be run on a ColdFusion server, of course, and the server must support CFFILE). Running the script will create a file called sitemap.xml that you can then submit to Google.

I haven't yet created code to automatically generate the original list of urls, but I will be working on that. Most likely, though, each person will have to do their own code for this as everyone's needs will be different. You may also need to make changes to this script to suit your needs. For example, you might want to pull from a database rather than a text file. If so, your database may contain fields that would be able to generate unique dates for each url, and/or unique priorities for each url. This is just a simple example of code that uses the same date and priority for every url. Still, I hope this helps some ColdFusion programmers out there who want to create their new Google sitemaps with a minimum of hassle.

WordPress refuses to display this properly, so click here to download a text file.