Discuz X3/3.1 門戶中的Keyword和Description顯示不正確的解決方法

字號:


    最近用站長工具查論壇的 SEO 的時候,忽然發(fā)現(xiàn),論壇門戶的 Keyword(關鍵詞) 和 Description(描述)都只剩下門戶倆字了。原來 Discuz 對游客屏蔽了關鍵詞與描述。雖然說用管理員賬號登陸后,可以正常顯示了。不過很難說蜘蛛或Robot是不是可以真正能獲取。所以為了收錄,還是改回來吧。具體方法為:
    找到文件“ source/class/helper/helper_seo.php ”這個文件
    搜索:
    代碼如下:
    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($keywordstext) {
    $seokeywords = helper_seo::strreplace_strip_split($searchs, $replaces, $keywordstext);
    }
    OK,最后登出后,再用游客身份查看源代碼,已經(jīng)可以看到 Description 和 Keyword 了,在用站長SEO工具測試一下,也OK了。。
    完事大吉!