新闻中心

Discuz X3/3.1 门户keyword与描述description源码不显示解决办法

作者 / 无忧主机 时间 2014-05-15 16:38:46

用户在无忧主机php虚拟主机下的discuz论坛升级到Discuz最新版本X3.1之后,会看见一个百度收录里面没有关键词keyword和描述description,小编分析了一下,现在是为了节省流量,在查看网站源代码的时候,现在只有以管理员身份才可以看的到页面的 keyword 和 description,如果是游客身份或者普通会员身份进入是看不到的。小编认为这个discuz X3.1的问题就是如果开启了游客缓存,那么接下来游客触发缓存后,就会造成蜘蛛也读取游客缓存,也就找不到keyword 和 description了。为了解决这个问题,下面小编给大家提供一下解决方案。(备注:修改之后游客可以看见keyword 和 description,如果开启了游客的缓存,则需要将游客缓存删除一下才会生效的!) 首先要搜索:进入:source/class/helper/helper_seo.php,找到: if($descriptiontext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) 之后改成: if($descriptiontext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) 然后在搜索:if($keywordstext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) { 修改成: if($keywordstext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || CURSCRIPT == 'portal' || IS_ROBOT || $_G['adminid'] == 1)) { 之后如果想开放SEO设置给客户看的话那就要找到: if($descriptiontext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) { $seodescription = helper_seo::strreplace_strip_split($searchs, $replaces, $descriptiontext); } if($keywordstext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) { $seokeywords = helper_seo::strreplace_strip_split($searchs, $replaces, $keywordstext); } 找到之后把代码修改成: if($descriptiontext) { $seodescription = helper_seo::strreplace_strip_split($searchs, $replaces, $descriptiontext); } if($keywordstex) { $seokeywords = helper_seo::strreplace_strip_split($searchs, $replaces, $keywordstext); } 小编温情提示:替换修改好了,记得上传到网站覆盖原文件就可以的! 相关文章推荐阅读: DISCUZ X3.1标题TITLE不支持空格解决方法 DISCUZX2.5版本任务模块刷积分漏洞解决办法 如何一次性删除DISCUZ论坛程序所有的帖子和主题

本文地址:https://www.51php.com/discuz/14094.html

1
1
1
1
1
1
1

客户服务热线

0791-8623-3537

在线客服