官方首页 | 无图版 | BBS首页
PJBlog3 2.8.5.157 新版发布 下载|升级(2008.8.26) 来给PJ3提提发展建议 2008版 PJHOME 珍藏/纪念版官方T恤 正式发布! PJ3内测团队主创人员身份,性格,特点吐血大曝光
PJBlog技术支持论坛使用问题总索引 PJ-Blog 3 斑竹日志 【独家】我使用过的三种空间,与客服的精彩故事 Z-Blog,Wordpress,Bo-Blog转换到PJBlog
 28 123
发新话题
打印

[原创]给你的文章页面添加真正的“关键字”,11月20日修复中文tag不能正常转换的bug!

[原创]给你的文章页面添加真正的“关键字”,11月20日修复中文tag不能正常转换的bug!

我们都知道,如果给你的网页添加“关键字”属性(也就是<meta name="keywords" c />),那么你的网页被搜索引擎搜索到的概率就会大很多。但是pjblog的“关键字”是固定不变的,所以就需要我们自己来改造一下,把每篇文章tags属性添加为网页的关键字,从而提高我们的网站被搜索引擎搜到的概率。
      演示:http://blog.theosoft.net
      原文:http://blog.theosoft.net/article.asp?id=24
      废话就说到这里,下面是具体的操作:
      首先打开article.asp,找到
   if blog_postFile then
      SQL="Select top 1 log_ID,log_CateID,log_title,Log_IsShow,log_ViewNums,log_Author,log_comorder,log_DisComment FROM blog_Content Where log_ID="&id&" and log_IsDraft=false"
     else
      SQL="Select top 1 log_ID,log_CateID,log_title,Log_IsShow,log_ViewNums,log_Author,log_comorder,log_DisComment,log_Content,log_PostTime,log_edittype,log_ubbFlags,log_CommNums,log_QuoteNums,log_weather,log_level,log_Modify,log_FromUrl,log_From,log_tag FROM blog_Content Where log_ID="&id&" and log_IsDraft=false"
    end if
把它改成
      SQL="Select top 1 log_ID,log_CateID,log_title,Log_IsShow,log_ViewNums,log_Author,log_comorder,log_DisComment,log_Content,log_PostTime,log_edittype,log_ubbFlags,log_CommNums,log_QuoteNums,log_weather,log_level,log_Modify,log_FromUrl,log_From,log_tag FROM blog_Content Where log_ID="&id&" and log_IsDraft=false"

然后打开header.asp,找到
<meta name="keywords" content=...这一句,改成
  <%dim tmpTag,tmp_tags,len_name
    len_name=Len(SiteName)
    If Left(Title,len_name)=SiteName Then
%>
  <meta name="keywords" c />
<%else
   set tmpTag=new tag
   tmp_tags=tmpTag.filterKeys(log_ViewArr(19,0))
%>
  <meta name="keywords" c />
<%end if%>
最后打开common\library.asp,找到
  Public function filterHTML(str) '过滤标签
    If isEmpty(str) or isNull(str) or len(str)=0 Then
        Exit Function
     filterHTML=str
  else
        dim log_Tag,log_TagItem
  For Each log_TagItem IN Arr_Tags
         log_Tag=Split(log_TagItem,"||")
   str=replace(str,"{"&log_Tag(0)&"}","<a href=""default.asp?tag="&Server.URLEncode(log_Tag(1))&""">"&log_Tag(1)&"</a><a href=""http://technorati.com/tag/"&log_Tag(1)&""" rel=""tag"" style=""display:none"">"&log_Tag(1)&"</a> ")
  Next
  Dim re
  Set re=new RegExp
  re.IgnoreCase =True
  re.Global=True
        re.Pattern="\{(\d)\}"
       str=re.Replace(str,"")
  filterHTML=str
end if
  end function
在其后添加如下代码
  Public function filterKeys(str) 'Theosoft (C) 2001-2006
    If isEmpty(str) or isNull(str) or len(str)=0 Then
        Exit Function
     filterKeys=str
  else
        dim log_Tag,log_TagItem
  For Each log_TagItem IN Arr_Tags
         log_Tag=Split(log_TagItem,"||")
   str=replace(str,"{"&log_Tag(0)&"}",log_Tag(1)&",")//此处于11月20日修改,修复中文tag的转换问题
  Next
  Dim re
  Set re=new RegExp
  re.IgnoreCase =True
  re.Global=True
        re.Pattern="\{(\d)\}"
       str=re.Replace(str,"")
  filterKeys=str
end if
  end function
保存,上传,收工!

欢迎大家和我一起交流!

代码已于11月20日修改,修复了中文tag不能正常转换的bug!

[ 本帖最后由 theosoft 于 2006-11-20 21:48 编辑 ]

TOP

真的有效果嘛?
敝站:http://www.haifol.com/,欢迎来踩踩!
PJ交流群(二):6448245

TOP

感觉pj好像并不太招百度的喜欢,抓得并不强
考试。。考试

TOP

这个不好说了,不过我站最近被GG搜索的关键字变多了~但是总体页面流量在百度和狗狗都下降了,尽管PR上升到了4~
敝站:http://www.haifol.com/,欢迎来踩踩!
PJ交流群(二):6448245

TOP

引用:
原帖由 嵘心天涯 于 2006-11-13 00:33 发表
感觉pj好像并不太招百度的喜欢,抓得并不强
是啊,不过搜狗和新浪抓的多

TOP

引用:
原帖由 alonefly 于 2006-11-13 11 发表
流量素浮云,PR也素浮云,自己想写点什么记点什么的时候有地方可以满足你才素王道。
广告位招租。

TOP

由于今天要考编译原理,所以这个bug直到现在我才有空去解决。
虽然看来好像用的人不多,但是还是过来更新一下,大家如果觉得好的话,可别忘了顶阿

TOP

请问哪位可以也把description的问题解决?

谢谢theosoft,关键字的问题已经解决...呵呵
现在就是"description"的问题了,因为description还是和header.asp上改过来的一样...
是不是可以把这个描述放在"编辑内容摘要"这里呢?

我的blog:www.dions.cn

TOP

引用:
原帖由 dion127 于 2006-11-21 04:14 发表
谢谢theosoft,关键字的问题已经解决...呵呵
现在就是"description"的问题了,因为description还是和header.asp上改过来的一样...
是不是可以把这个描述放在"编辑内容摘要"这里呢?

我的 ...
"内容摘要"是要显示在首页的,内容较多,如果一起设为网页的属性的话,是不是……
再说,"description"好像没啥用吧,我直接删掉了……

TOP

好东西肯定有人顶 
  人才啊

TOP

 28 123
发新话题