Friends who have read it can help you. These codes are posted for the first time. There are many of them outside, either they are very complicated and cannot be understood or they cannot be used. I have tried to be as concise and clear as possible when writing the following.
Many so-called sitemap generation codes outside only generate directory file addresses and do not generate dynamics. I later wrote this myself, which supports dynamics. Example:
If you are an article website and have 2,000 articles, then you can modify the corresponding article data table to generate 2,000 dynamic addresses in addition to all directory files. It is absolutely nothing to say, and the generation speed is very fast.
Save the following code as sitemap.asp file, modify a few places I have noted, do not modify any other ones, and only know if it has been used
Copy the code code as follows:<!--#includefile="conn.asp"-->
<%
session("count")=0
strURL="http://"&request.servervariables("SERVER_NAME")&_
left(request.servervariables("SCRIPT_NAME"),len(request.servervariables("SCRIPT_NAME"))-len("/sitemap.asp"))
dimfoolcat
foolcat=foolcat+"<?xmlversion=""1.0""encoding=""UTF-8""?>"
foolcat=foolcat+"<!--GoogleSiteMapFileGeneratedbyhttp://www.xxx.com"&return_RFC822_Date(now,"GMT")&"-->"
foolcat=foolcat+"<urlsetxmlns=""http://www.google.com/schemas/sitemap/0.84">"
foolcat=foolcat+"<url>"
foolcat=foolcat+"<loc>"&strURL&"/</loc>"
foolcat=foolcat+"</url>"
session("count")=session("count")+"1"
setall_fs=Server.CreateObject("Scripting.FileSystemObject")
setall_folder=all_fs.GetFolder(server.MapPath("/"))
setall_files=all_folder.files
foreachfileinall_files
foolcat=foolcat+"<url>"
foolcat=foolcat+"<loc>"&strURL&"/"&File.Name&"</loc>"
foolcat=foolcat+"</url>"
session("count")=session("count")+"1"
next
dimjs,sql
setjs=server.CreateObject("ADODB.RecordSet")
sql="select*from[table name to generate] orderbysidac"//Modify the data table name you want to generate
setjs=conn.execute(sql)
dountiljs.eof
id=""&js("id")&"//Modify to your id field
foolcat=foolcat+"<url>"
foolcat=foolcat+"<loc>"&strURL&"/xxx.asp?Id="&id&"</loc>"//Modify to your file name and id