页面上的关键字标签,并自动为采集的新闻添加关键字

优采云 发布时间: 2020-08-07 07:03

  [IT168技术文章]为了方便搜索引擎,文章系统模仿了NB文章系统来制作页面关键字的标签!

  第一步

  位于foosun \ Admin \ Refresh \ Function.asp

  中

  函数GetNewsContent(TempletContent,NewsRecordSet,NewsContent)

  TempletContent = Replace(TempletContent,“ {News_Title}”,NewsRecordSet(“ Title”))

  在下面添加

  “关键字代码”

  如果不是IsNull(NewsRecordSet(“ keywords”)),则

  TempletContent =替换(TempletContent,“ {News_keywords}”,NewsRecordSet(“ keywords”))

  其他

  TempletContent = Replace(TempletContent,“ {News_keywords}”,“”)

  如果结束

  “关键字代码”

  在倒数第二行的%>之前,添加

  '****************************************

  'author: lino

  '将标题与关键字表中的记录匹配

  “开始

  '*************************

  函数replaceKeywordByTitle(title)

  Dim whereisKeyword,i,theKeywordOnNews

  Dim关键字,rsRuleObj,theKeywordS

  '***如果您使用的是3.0版,请将下游fs_Routine更改为“常规”

  设置RsRuleObj = Conn.Execute(“从FS_Routine中选择*”)

  在非RsRuleObj.Eof时执行

  关键字= RsRuleObj(“名称”)

  whereisKeyword = InStr(Lcase(title),Lcase(keyword))

  if(whereisKeyword> 0)然后

  如果(theKeywordOnNews =“”)然后

  theKeywordOnNews =关键字

  其他

  theKeywordOnNews = theKeywordOnNews&“”&key

  如果结束

  如果结束

  RsRuleObj.MoveNext

  循环

  '如果关键字的长度大于100,则剪掉太长的

  如果(len(theKeywordOnNews)> 99)然后

  theKeywordOnNews = left(theKeywordOnNews,99)

  如果结束

  replaceKeywordByTitle = theKeywordOnNews

  结束功能

  '**********************

  '结束

  第二步

  在foosun / funpages / lablenews.asp

  查找选择插入字段

  在下面添加

  “页面关键字标记”

  页面关键字

  “页面关键字标记”

  第三步

  在foosun / admin / info / newswords.asp中找到约306行

  INewsAddObj(“ KeyWords”)= Replace(Replace(Request(“ KeywordText”),“”“”,“”),“'”,“”)

  将此句子修改为

  '****************************************

  'author: lino

  '调用replaceKeywordByTitle方法来过滤关键字

  '如果用户具有自定义关键字,则自动关键字设置将无效

  “开始

  '*************************

  Dim KeywordText

  如果(Request(“ KeywordText”)=“ =”或isempty(Request(“ KeywordText”))))然后

  KeywordText = replaceKeywordByTitle(ITitle)

  其他

  KeywordText =请求(“ KeywordText”)

  如果结束

  如果KeywordText为“”,则

  INewsAddObj(“ KeyWords”)= Replace(Replace(KeywordText,“”“”,“”),“'”,“”)

  如果结束

  '结束

  '***************************************

  第四步

  在Foosun / Admin / Collect / movenewstosystem.asp中找到约117行

  RsSysNewsObj(“ TxtSource”)= RsNewsObj(“ Source”)

  更改为

  RsSysNewsObj(“ keywords”)= replaceKeywordByTitle(RsNewsObj(“ title”))

  程序更改成功!

  在下面制作标签,您可以在自定义标签的新闻浏览中自行选择页面关键字标签

  具体标签如下{News_keywords},写在新闻模板的标题或元中心,以方便搜索引擎收录!

0 个评论

要回复文章请先登录注册


官方客服QQ群

微信人工客服

QQ人工客服


线