Discuz X2默认情况下是首页的keywords和description是显示成"首页"的,只有给蜘蛛或者是登录以后,才会显示成真正的值.这样,虽然能减小页面大小(少的可怜),却可能被其它蜘蛛或者爬行的机器人给忽略掉,造成seo损失.这里,官网也有比较好的解决方式.
首页
修改一下source\function\function_core.php文件:将
[code]if($descriptiontext && (CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) {
$seodescription = strreplace_strip_split($searchs, $replaces, $descriptiontext);
}
if($keywordstext && (CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) {
$seokeywords = strreplace_strip_split($searchs, $replaces, $keywordstext);
}[/code]
修改为:
[code]if($descriptiontext) {
$seodescription = strreplace_strip_split($searchs, $replaces, $descriptiontext);
}
if($keywordstext) {
$seokeywords = strreplace_strip_split($searchs, $replaces, $keywordstext);
}[/code]
帖子内容页:
修改一下 source\module\forum\forum_viewthread.php:
将:
[code]if(IS_ROBOT || $_G['adminid'] == 1) $summary = str_replace(array("\r", "\n"), '', messagecutstr(strip_tags($post['message']), 160));[/code]修改为:
[code]$summary = str_replace(array("\r", "\n"), '', messagecutstr(strip_tags($post['message']), 160));[/code]
声明: 信息来源于官网,玩改车做了一些解释和修改.