国产白浆流出一区二区-精品日韩欧美一区二区-亚洲欧美精品一区久久-久草精品在线播放视频

全國服務(wù)熱線:400-603-3310 廣州熱線:020-85201720   網(wǎng)站專線:020-85201717

專題中心 聯(lián)系我們

廣州網(wǎng)站建設(shè) 網(wǎng)站制作 網(wǎng)站設(shè)計(jì)公司 廣州騰虎網(wǎng)絡(luò)科技有限公司

WHAT'S NEW?

新聞動(dòng)態(tài)

致力提供國內(nèi)性價(jià)比高的建站資訊

當(dāng)前位置: > 騰虎新聞 > 網(wǎng)站優(yōu)化 >

Google網(wǎng)站地圖生成代碼

騰虎網(wǎng)絡(luò):2010-05-06  閱讀數(shù):  分享到:
將下面的代碼保存為sitemap.asp,然后放到網(wǎng)站根目錄下,設(shè)定要生成的文件夾名字,運(yùn)行,就OK了。

<%

' sitemap.asp

session("count")=0

'你的域名

session("server")="http://"&Request.ServerVariables("SERVER_NAME")

'制作生成SiteMap.xml的目錄,后面不要帶"/",大小寫敏感

vDir = "SiteMap.xml"

'設(shè)置你想要GOOGLE收錄的文件文件名擴(kuò)展名

Extensions = Array("png","gif","jpg","jpeg","zip","pdf","ps","html","htm","asp","php","wk1","wk2","wk3","wk4","wk5","wki","wks","wku","lwp","mw","xls","ppt","doc","swf","wks","wps","wdb","wri","rtf","ans","txt","shtml","shtm")

'需要過濾的目錄

PathExclusion=Array("\admin","\_vti_cnf","_vti_pvt","_vti_log","cgi-bin","aspnet_client")

set objfso = CreateObject("Scripting.FileSystemObject")

root = Server.MapPath(vDir)

'response.End

'創(chuàng)建文件

objfso.createtextfile(server.mappath(vDir))

response.write "<p><strong style='font-family:arial,sans-serif;font-size=12'>創(chuàng)建"&vDir&" 功!</strong><I style='font-family:arial,sans-serif;font-size=12'> "&server.mappath(vDir)&" </I></p>"

response.write "<p><strong style='font-family:arial,sans-serif;font-size=12'>正在索引文件,請(qǐng)稍侯...< /strong></p>"

Set openfileobj=objfso.opentextfile(server.mappath(vDir),8)

openfileobj.writeline"<?xml version='1.0' encoding='UTF-8'?>"

openfileobj.writeline"<urlset xmlns='http://www.google.com/schemas/sitemap/0.84'>"

'===

str=root

strLeft=split(str,vDir)(0)

'===

Set objFolder = objFSO.GetFolder(strLeft)

Set colFiles = objFolder.Files

For Each objFile In colFiles

openfileobj.writeline getfilelink(objFile.Path,objfile.dateLastModified)

Next

ShowSubFolders(objFolder)

openfileobj.writeline "</urlset>"

response.write "<p><strong style='font-family:arial,sans-serif;font-size=12'>"&vDir&"生成完 畢,共<span style=color:#FF0000> "&session("count")&" </span>個(gè)文件被索引</strong></p>"

set fso = nothing

Sub ShowSubFolders(objFolder)

Set colFolders = objFolder.SubFolders

For Each objSubFolder In colFolders

if folderpermission(objSubFolder.Path) then

openfileobj.writeline getfilelink(objSubFolder.Path,objSubFolder.dateLastModified)

Set colFiles = objSubFolder.Files

For Each objFile In colFiles

openfileobj.writeline getfilelink(objFile.Path,objFile.dateLastModified)

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)

strLeft=replace(strLeft,"\","/")

file=(split(LCASE(file),LCASE(strLeft)))(1)

getfilelink = "<url>"&Chr("10")&"<loc>"&server.htmlencode(session("server")&"/"&file)&"</loc>"&Chr("10")&"<lastmod>"&filedate&"</lastmod>"&Chr("10")&"<changefreq>daily</changefreq>"&Chr("10")&"<priority>1.0</priority>"&Chr("10")&"</url>"

session("count")=session("count")+"1"

Response.Flush

End Function

Function Folderpermission(pathName)

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

if len(trim(sFileName)) = 0 then

FileExtensionIsBad = true

Exit Function

end if

sFileExtension = right(sFileName, len(sFileName) - instrrev(sFileName, "."))

bFileExtensionIsValid = false

for each sFileExt in extensions

if ucase(sFileExt) = ucase(sFileExtension) then

bFileExtensionIsValid = True

exit for

end if

next

FileExtensionIsBad = not bFileExtensionIsValid

End Function

%>

官方微信

公司地址:廣州市天河區(qū)福元南路4號(hào)達(dá)維商務(wù)中心2305
銷售熱線:020-85201720  85201717  或 400-603-3310

版權(quán)所有:廣州騰虎網(wǎng)絡(luò)科技有限公司
粵ICP備13073147號(hào) 

粵公網(wǎng)安備 44010602001101號(hào)