Asp google sitemap builder code

Source: Internet
Author: User
<% 'Asp-google-sitemaps.asp 'by David Yin' into v0.1 08.30.06' 'BSD 2.0 license, 'license ("server") = "http://www.yourdomain.net/" vDir = "/" phisicalDir = "C: inetpubwwwroot "'Time zone setting. The difference utcOffset = 1 set objfso = CreateObject (" Scripting. fileSystemObject ") root = Serve R. MapPath (vDir) response. ContentType = "text/xml" response. write "<? Xml version = '1. 0' encoding = 'utf-8'?> "Response. write" <! -- Generator = 'http: // seo.g2soft.net/online-tools/' --> "response. write "<urlset xmlns = 'http: // www.google.com/schemas/sitemap/0.84'>" Set objFolder = objFSO. getFolder (root) Set colFiles = objFolder. filesFor Each objFile In colFilesresponse. write getfilelink (objFile. path, objfile. dateLastModified) NextShowSubFolders (objFolder) response. write "</urlset>" set fso = nothingSub ShowSubFolders (objFolder) Set colFolders = objFolder. subFoldersFor Each objSubFolder In colFoldersif folderpermission (objSubFolder. path) thenresponse. write getfilelink (objSubFolder. path, objSubFolder. dateLastModified) Set colFiles = objSubFolder. filesFor Each objFile In colFilesresponse. write getfilelink (objFile. path, objFile. dateLastModified) NextShowSubFolders (objSubFolder) end ifNextEnd SubFunction getfilelink (file, data) file = replace (file, phisicalDir, "") file = replace (file ,"","/") if FileExtensionIsBad (file) then Exit FunctionIf FileNameIsBad (file) then Exit Functionfilelmdate = iso8601date (data, utcOffset) getfilelink = "<url> <loc>" &server.html encode (session ("server") & file) & "</loc> <lastmod>" & filelmdate & "</lastmod> <priority> 1.0 </priority> </url>" session ("URLS ") = session ("URLS") + 1Response. flushEnd FunctionFunction Folderpermission (pathName) 'specifies the directory PathExclusion = Array ("temp", "_ vti_cnf", "_ vti_pvt", "_ vti_log ", "cgi-bin") partition = Truefor each PathExcluded in your instr (ucase (pathName), ucase (PathExcluded)> 0 partition = Falseexit forend ifnextEnd FunctionFunction partition (sFileName) Dim sFileExtension, bFileExtensionIsValid, sFileExt 'http: // www.googleguide.com/file_type.htmlExtensions = Array ("png", "gif", "jpg", "zip", "pdf", "ps", "html ", "htm", "asp", "wk1", "wk2", "wk3", "wk4", "wk5", "wki", "wks", "wku ", "lwp", "mw", "xls", "ppt", "doc", "wks", "wps", "wdb", "wri", "rtf ", "ans", "txt") if len (trim (sFileName) = 0 thenFileExtensionIsBad = trueExit Functionend ifsFileExtension = right (sFileName, len (sFileName)-Limit Rev (sFileName ,". ") condition = false 'assume extension is badfor each sFileExt in extensionsif ucase (sFileExt) = ucase (sFileExtension) condition = Trueexit forend identifier = not enough FunctionFunction FileNameIsBad (sFileName) if len (trim (sFileName) = 0 then FileNameIsBad = true Exit Function end if Filename = Array ("/alive. asp ","/404.asp", "/500.asp","/sitemap_gen.asp ") FileNameNumber = ubound (Filename) for I = 0 to FileNameNumber if Filename (I) = sFileName then FileNameIsBad = True end if nextEnd FunctionFunction iso8601date (dLocal, utcOffset) Dim d' convert local time d = DateAdd ("H",-1 * utcOffset, dLocal) 'compose the dateiso8601date = 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 %>

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.