-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsitemap.asp
60 lines (52 loc) · 2.28 KB
/
sitemap.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!-- #include file="asp/begin.asp"-->
<%'this script flushes a XML sitemap. You can validate/submit this sitemap on
'sites like http://www.xml-sitemaps.com/validate-xml-sitemap.html
'All you have to do is provide the link http://www.yourQsite.com/sitemap.asp
'Next, notify the different Search Engines of your sitemap.
dim sitemap
sitemap="<?xml version=""1.0"" encoding=""UTF-8""?>" & vbcrlf
sitemap=sitemap & "<urlset" & vbcrlf
sitemap=sitemap & "xmlns=""http://www.sitemaps.org/schemas/sitemap/0.9""" & vbcrlf
sitemap=sitemap & "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""" & vbcrlf
sitemap=sitemap & "xsi:schemaLocation=""http://www.sitemaps.org/schemas/sitemap/0.9" & vbcrlf
sitemap=sitemap & "http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"">"& vbcrlf
'reuse the search feature to get a list of all pages
dim getSiteMap
set getSiteMap=new cls_search
getSiteMap.includeURL=false
getSiteMap.allowEmptyString=true
getSiteMap.includeListItems=true
getSiteMap.value=""
dim getResults
set getResults=getSiteMap.results
'loop through the resultset
dim pageKey
for each pageKey in getResults
'theme?
if convertGetal(getResults(pageKey).iThemeID)<>0 then
dim posts
set posts=db.execute("select iId from tblPost where (iPostID is null or iPostID=0) and iThemeID="& getResults(pageKey).iThemeID)
while not posts.eof
sitemap=sitemap & "<url>"& vbcrlf &"<loc>"& customer.sQSUrl & "/default.asp?iId="& encrypt(pageKey) &"&iPostID="& encrypt(posts("iId")) & "</loc>" & vbcrlf & "</url>"& vbcrlf
posts.movenext
wend
end if
sitemap=sitemap & "<url>"& vbcrlf
'listitem?
if convertGetal(getResults(pageKey).iListPageID)<>0 then
sitemap=sitemap & "<loc>"& customer.sQSUrl & "/default.asp?iId="& encrypt(getResults(pageKey).iListPageID) &"&item="& encrypt(pagekey) &"</loc>"& vbcrlf
'user friendly url?
elseif customer.bUserFriendlyURL and not isLeeg(getResults(pageKey).sUserFriendlyURL) then
sitemap=sitemap & "<loc>"& customer.sQSUrl & "/"& getResults(pageKey).sUserFriendlyURL &"</loc>"& vbcrlf
'any other page
else
sitemap=sitemap & "<loc>"& customer.sQSUrl & "/default.asp?iId="& encrypt(pageKey) &"</loc>"& vbcrlf
end if
sitemap=sitemap & "</url>"& vbcrlf
next
sitemap=sitemap & "</urlset>"& vbcrlf
set getResults=nothing
set getSiteMap=nothing
'flush the sitemap
Response.Write sitemap
cleanUPASP()%>