咔叽游戏

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 377|回复: 0

[discuz教程] Discuz X3/3.1 门户中的Keyword和Description显示不正确的解决方法

[复制链接]
  • TA的每日心情
    无聊
    2019-5-27 08:20
  • 签到天数: 4 天

    [LV.2]圆转纯熟

    发表于 2021-12-29 13:15:00 | 显示全部楼层 |阅读模式
    最近用站长工具查论坛的 SEO 的时候,忽然发现,论坛门户的 Keyword(关键词) 和 Description(描述)都只剩下门户俩字了。原来 Discuz 对游客屏蔽了关键词与描述。虽然说用管理员账号登陆后,可以正常显示了。不过很难说蜘蛛或Robot是不是可以真正能获取。所以为了收录,还是改回来吧。具体方法为:
    找到文件“ source/class/helper/helper_seo.php ”这个文件
    搜索:
    1. if($descriptiontext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) {
    2. $seodescription = helper_seo::strreplace_strip_split($searchs, $replaces, $descriptiontext);
    3. }
    4. if($keywordstext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) {
    5. $seokeywords = helper_seo::strreplace_strip_split($searchs, $replaces, $keywordstext);
    6. }
    复制代码
    修改为:
    1. if($descriptiontext) {
    2. $seodescription = helper_seo::strreplace_strip_split($searchs, $replaces, $descriptiontext);
    3. }
    4. if($keywordstext) {
    5. $seokeywords = helper_seo::strreplace_strip_split($searchs, $replaces, $keywordstext);
    6. }
    复制代码
    OK,最后登出后,再用游客身份查看源代码,已经可以看到 Description 和 Keyword 了,在用站长SEO工具测试一下,也OK了。。
    完事大吉!

    QQ|免责声明|小黑屋|手机版|Archiver|咔叽游戏

    GMT+8, 2024-3-29 00:55

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表