Apr 28 2008

Easy Dynamic Google Sitemap with ColdFusion

Published by Jeff at 7:46 am under ColdFusion

Have you ever wanted to have your google sitemap updated on the fly based on your postings or other data? This is a simple but effective example:

<CFQUERY name="qFind" datasource="astores">
select * from astores_names
</CFQUERY>

<cfxml variable="mydoc">
  <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
    <cfoutput query="qFind">
      <url>
       <loc>http://www.thewarp.org/blog/store.cfm?site=#store_name#</loc>
       <changefreq>daily</changefreq>
       <priority>0.8</priority>
       </url>
    </cfoutput>
  </urlset>
</cfxml>

<!--- <cfdump var=#mydoc#> ---><CFCONTENT
TYPE="text/xml"
RESET="yes"><CFOUTPUT>#ToString(mydoc)#</CFOUTPUT>

An example can be seen here:

http://www.thewarp.org/store_xml.cfm

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]


Trackback URI | Comments RSS

Leave a Reply