Discuz X2默認(rèn)情況下是首頁的keywords和description是顯示成"首頁"的,只有給蜘蛛或者是登錄以后,才會顯示成真正的值.這樣,雖然能減小頁面大小(少的可憐),卻可能被其它蜘蛛或者爬行的機(jī)器人給忽略掉,造成seo損失.這里,官網(wǎng)也有比較好的解決方式.
首頁
修改一下source\function\function_core.php文件:將
- 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);
- }
復(fù)制代碼
修改為:
- if($descriptiontext) {
- $seodescription = strreplace_strip_split($searchs, $replaces, $descriptiontext);
- }
- if($keywordstext) {
- $seokeywords = strreplace_strip_split($searchs, $replaces, $keywordstext);
- }
復(fù)制代碼
帖子內(nèi)容頁:
修改一下 source\module\forum\forum_viewthread.php:
將:
- if(IS_ROBOT || $_G['adminid'] == 1) $summary = str_replace(array("\r", "\n"), '', messagECUtstr(strip_tags($post['message']), 160));
復(fù)制代碼 修改為:
- $summary = str_replace(array("\r", "\n"), '', messagecutstr(strip_tags($post['message']), 160));
復(fù)制代碼
聲明: 信息來源于官網(wǎng),玩改車做了一些解釋和修改.
|