国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

google sitemap.asp

2024-05-04 10:58:45
字體:
來源:轉載
供稿:網友
用于生成sitemap.xml文件的東西,利于google等搜索引擎的抓取。
復制代碼 代碼如下:

<%
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 2005 (Listing a directory tree recursively improvement)
'
' BSD 2.0 license,
' http://www.opensource.org/licenses/bsd-license.php
' 收集整理:重慶森林@im286.com
session("server")="http://www.survivalescaperooms.com"
'你的域名
vDir = "/"
'制作SiteMap的目錄,相對目錄(相對于根目錄而言)
set objfso = CreateObject("Scripting.FileSystemObject")
root = Server.MapPath(vDir)

'response.ContentType = "text/xml"
'response.write "<?xml version='1.0' encoding='UTF-8'?>"
'response.write "<urlset xmlns='http://www.google.com/schemas/sitemap/0.84'>"

str = "<?xml version='1.0' encoding='UTF-8'?>" & vbcrlf
str = str & "<urlset xmlns='http://www.google.com/schemas/sitemap/0.84'>" & vbcrlf

Set objFolder = objFSO.GetFolder(root)
'response.write getfilelink(objFolder.Path,objFolder.dateLastModified)
Set colFiles = objFolder.Files
For Each objFile In colFiles
'response.write getfilelink(objFile.Path,objfile.dateLastModified)
str = str & getfilelink(objFile.Path,objfile.dateLastModified) & vbcrlf
Next
ShowSubFolders(objFolder)

'response.write "</urlset>"
str = str & "</urlset>" & vbcrlf
set fso = nothing

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 '生成的XML文件名
.Close
End With

Set objStream = Nothing
If Not Err Then
Response.Write("<script>alert('success!');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
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 巴彦淖尔市| 观塘区| 哈尔滨市| 日土县| 西乡县| 崇阳县| 西和县| 正镶白旗| 阳谷县| 太康县| 商洛市| 凤山市| 兴和县| 哈密市| 虎林市| 舟曲县| 海门市| 罗城| 横峰县| 改则县| 新巴尔虎左旗| 天镇县| 邵东县| 南木林县| 廊坊市| 昌图县| 平果县| 株洲市| 普陀区| 新晃| 章丘市| 乌拉特前旗| 大邑县| 南阳市| 城市| 彭泽县| 洛宁县| 沅陵县| 扬中市| 封丘县| 苍梧县|