<% ' sitemap_gen_db.asp ' A simple script (using database) to automatically produce sitemaps for a webserver, in the Google Sitemap Protocol (GSP) ' by Francesco Passantino ' www.iteam5.net/francesco/sitemap_gen ' v0.1b released 5 june 2005 ' v0.2 released 17 june 2005 iso8601dates http://www.tumanov.com/projects/scriptlets/iso8601dates.asp ' v0.2b released 28 july 2005 id_page=Server.URLEncode(rs("id")) to put words in id, thanks to Mike Kellogg ' ' BSD 2.0 license, ' http://www.opensource.org/licenses/bsd-license.php MAXURLS_PER_SITEMAP = 50000 'modify this to change website, baseurl and table baseurl="http://www.yoursite.com/default.asp?page=" xDb_Conn_Str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("db\yourdb.mdb") & ";" strsql = "SELECT * FROM yourtable" 'see http://www.time.gov/ for utcOffset utcOffset=1 response.ContentType = "text/xml" response.write "" response.write "" response.write "" Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str Set rs = Server.CreateObject("ADODB.Recordset") rs.Open strsql, conn Do while not rs.eof if URLS1.0 then priority="1.0" response.write ""&server.htmlencode(baseurl&id_page)&""&filedate&""&priority&"" URLS=URLS+1 Response.Flush rs.movenext end if Loop response.write "" rs.Close Set rs = Nothing conn.Close Set conn = Nothing Function iso8601date(dLocal,utcOffset) Dim d ' convert local time into UTC d = DateAdd("H",-1 * utcOffset,dLocal) ' compose the date iso8601date = Year(d) & "-" & Right("0" & Month(d),2) & "-" & Right("0" & Day(d),2) & "T" & _ Right("0" & Hour(d),2) & ":" & Right("0" & Minute(d),2) & ":" & Right("0" & Second(d),2) & "Z" End Function %>