Discuz X2首页keywords和description显示问题

玩改车 书生 2011-10-28
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]
声明: 信息来源于官网,玩改车做了一些解释和修改.

相关专题

相关推荐

Discuz! X2标题去掉"Powered by Discuz!"完美修改方法

Discuz X2首页keywords和description显示问题

Discuz! X2禁止前台文章列表页缩略图显示修改方法

提升Discuz门户文章收录最有效的办法

Discuz X2.5 keywords和description只能看到“首页”的解决办法

解决Discuz上传图片(附件)"Upload Error: 500"错误!

Discuz X2.5完美支持WinCache的方法分享

Discuz远程附件图片裁切无法更新的问题修复

Discuz门户文章中图片设置Alt属性

解决Discuz关联链接无法嵌套的问题