对5uCMS生成sitemaps时处理jumpurl的改进
作者:leolu 日期:2009-5-14 9:3:16
由于google希望sitemap提供的是最终目的地,但是现在5uCMS中如果你的勾选那跳转选项时,生成的sitemap中的地址仍然是按规则生成的内容页的地址,因此对google的引擎来说是不友好的.
为什么我说sitemaps重定向对引擎不友好?在 用好Google管理员工具 中有提到过,重定项地址页面google一般情况下是不去抓取地,除非你在网站地页面中有链接直接过去,但是如果能给出直接地址地sitemap为什么我们不呢?
因此我对admin_createhtml.asp文件做那如下改动:
SQL = "Select [FilePath],[Modifytime],[ID],[Cid],[Diyname],[Createtime],[Viewpath],[jumpurl] from [{pre}Content] Where [Display]=1"
Set Rs = DB(SQL,1)
Do While Not Rs.Eof
i = i + 1
If sitemapsBody = "" Then sitemapsBody = "<?xml version=""1.0"" encoding=""UTF" & "-8""?>" & vbcrlf & "<urlset xmlns=""http://www.google.com/schemas/sitemap/0.84"">" & vbcrlf
if Trim(Rs("jumpurl"))<>"" then
if instr(Rs("jumpurl"),httpurl)>0 then
aUrl = BuildViewPath(Rs("ID"),Rs("Cid"),Rs("Diyname"),Rs("Createtime"),Rs("jumpurl"))
else
aUrl = ""
end if
else
aUrl = BuildViewPath(Rs("ID"),Rs("Cid"),Rs("Diyname"),Rs("Createtime"),Rs("Viewpath"))
if aUrl<>"" then
sitemapsBody = sitemapsBody & "<url>" & vbcrlf & "<loc>" & aUrl & "</loc>" & vbcrlf & "<lastmod>" & aTime & "</lastmod>" & vbcrlf & "<priority>" & PR & "</priority>" & vbcrlf & "</url>" & vbcrlf
end if
检索时将jumpurl一并检索出来,并判断时候为空,如果为空进行一般的普通内容页的sitemap地址生成,否则生成jumpurl指向的url.
另外当跳转的目的地地地址和本站域名不一致地话,则省掉该url,比如我的酷站欣赏,都是链接到目的站点,因此没有必要生成到sitemaps中去.
本文原标题:对5uCMS生成sitemaps时处理jumpurl的改进
请转载的朋友加上本文的链接地址:)
我的博客地址[http://blog.csscss.org/]
上一篇
下一篇
Tags: