google|sitemap|xml| Generate XML ASP version, need space for FSO support
I won't tell you how to use it.
Moderator feel the can, give a fine
The first time OH
CODE: [Copy to Clipboard]
<%
server.scripttimeout=50000
' Sitemap_gen.asp
' A simple script to automatically produce sitemaps for A webserver, in the Google Sitemap Protocol (GSP)
' By Francesco Passantino
' Www.iteam5.net/francesco/sitemap
' v0.2 released 5 June (Listing a directory tree recursively improvement)
'
' BSD 2.0 License,
' Http://www.opensource.org/licenses/bsd-license.php
' Collection and collation: Chongqing Forest @im286.com
Session ("server") = "http://192.168.0.111" ' Your domain name
VDir = "/" "Make sitemap Directory, relative directory (relative to root directory)
Set objFSO = CreateObject ("Scripting.FileSystemObject")
Root = Server.MapPath (VDir)
Set objstream = Server.CreateObject ("ADODB. Stream ")
With Objstream
'. Type = adTypeText
'. Mode = adModeReadWrite
. Open
. Charset = "Utf-8"
. Position = Objstream.size
. Writetext=str
. SaveToFile Server.MapPath ("/sitemap.xml"), 2 ' generated XML filename
. Close
End With
Set objstream = Nothing
If not ERR Then
Response.Write ("<script>alert) (' successful generation of site map! '); History.back ();</script> ")
Response.End
End If
Sub ShowSubFolders (objfolder)
Set colfolders = objfolder.subfolders
For each objsubfolder in Colfolders
If Folderpermission (Objsubfolder.path) Then
' Response.Write Getfilelink (objsubfolder.path,objsubfolder.datelastmodified)
str = str & Getfilelink (objsubfolder.path,objsubfolder.datelastmodified) & vbCrLf
Set colfiles = Objsubfolder.files
For each objfile in Colfiles
' Response.Write Getfilelink (objfile.path,objfile.datelastmodified)
str = str & Getfilelink (objfile.path,objfile.datelastmodified) & vbCrLf
Next
ShowSubFolders (Objsubfolder)
End If
Next
End Sub
Function Getfilelink (File,datafile)
File=replace (File,root, "")
File=replace (file, "\", "/")
If Fileextensionisbad (file) then Exit Function
If month (datafile) <10 then filedatem= "0"
If Day (datafile) <10 then filedated= "0"
Filedate=year (datafile) & "-" &filedatem&month (datafile) & "-" &filedated&day (datafile)
Getfilelink = "<url><loc>" &server.htmlencode (Session ("Server") &vdir&file) & "</loc ><lastmod> "&filedate&" </lastmod><changefreq>daily</changefreq><priority >1.0</priority></url> "
Response.Flush
End Function
Function folderpermission (PathName)
' Directory (not listed in Sitemap) that needs to be filtered
Pathexclusion=array ("\temp", "\_vti_cnf", "_vti_pvt", "_vti_log", "Cgi-bin", "\admin", "\edu")
Folderpermission =true
For each pathexcluded in Pathexclusion
If InStr (UCase (PathName), UCase (pathexcluded)) >0 Then
Folderpermission = False
Exit For
End If
Next
End Function
Function Fileextensionisbad (sFileName)
Dim sfileextension, Bfileextensionisvalid, Sfileext
' Modify for your file extension (http://www.googleguide.com/file_type.html)
Extensions = Array ("PNG", "gif", "JPG", "jpeg", "Zip", "PDF", "PS", "html", "htm", "php", "WK1", "Wk2", "WK3", "Wk4", "Wk5", " Wki "," wks "," WKU "," LWP "," MW "," xls "," ppt "," Doc "," SwF "," wks "," WPS "," wdb "," WRI "," RTF "," ans "," txt ")
' Set the file name of the list, and the extension is not included in the Sitemap will not include the file for that extension
If Len (Trim (sfilename)) = 0 Then
Fileextensionisbad = True
Exit Function
End If
Sfileextension = Right (sFileName, Len (sfilename)-InStrRev (sFileName, "."))
Bfileextensionisvalid = False ' assume extension is bad
For each sfileext in extensions
If UCase (sfileext) = UCase (sfileextension) Then
Bfileextensionisvalid = True
Exit For
End If
Next
Fileextensionisbad = Not Bfileextensionisvalid
End Function
%>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.