91豆麻精品91久久久久久,中文在线资源,国产精品女视频,yw.139尤物在线精品视频

?
  歡迎訪問全國企業網站設計NO.1網站開發商平臺 付款方式
主頁 > 網站建設 > 建站知識 > DedeCms采集沒有自動生成摘要和關鍵字的解決辦法

DedeCms采集沒有自動生成摘要和關鍵字的解決辦法

POST TIME:2020-10-09

織夢5.6采集到了內容,可沒有自動生成摘要和關鍵字,關鍵字和摘要都是空的。

可能很多人都遇到了和我一樣的問題,在論壇實在沒找到好的解決辦法,就自己動手去改改文件。廢話不多說了。

下面是我的解決辦法

比如我采集了網站:http://www.52iphone8.com

首頁的meta代碼是:

Copy to ClipboardLiehuo.Net Codes引用的內容:[www.dede58.com]
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>iphone蘋果中文網</title> 
<meta name=description content="蘋果iPhone手機中文官網,為您提供蘋果iPhone 4代手機最新報價,同時包括蘋果iPhone手機圖片、蘋果iPhone手機參數、蘋果iPhone手機主題、蘋果iPhone手機軟件、蘋果iPhone手機游戲、蘋果iPhone手機評測行情、蘋果iphone視頻、蘋果iphone鈴聲、蘋果iPhone手機論壇、蘋果iPhone手機下載等信息。" /> 
<meta name=keywords content="蘋果手機,iphone,蘋果中文網,蘋果手機官網,iphone4代,蘋果iphone,iPhone手機,蘋果手機報價,圖片,論壇,游戲,電影,主題,鈴聲,鈴聲,下載,軟件,應用" /> 

如果用dedecms的采集的時候就沒有辦法自動獲取description和keywords的值的。 
大家注意到了這段代碼和其它網站的區別了沒?? 
<meta name=description content=... /> 
<meta name=keywords content=... /> 
就是name="description" 和 name="keywords" 少了雙引號"" 
這個可能是dedecms中自動分析關鍵字和摘要的一個bug吧,沒有考慮到<meta name=keywords content ='' />這種情況! 
采集的選項里面也沒有自己填寫關鍵字和摘要的選項。那我只能自己動手修改文件了。 
1、修改 include/dedecollection.class.php

Copy to ClipboardLiehuo.Net Codes引用的內容:[www.dede58.com]
//自動分析關鍵字和摘要 
preg_match("/<meta[\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr); 
preg_match("/<meta[\s]+content=['\"](.*)['\"] name=['\"]keywords['\"]/isU",$this->tmpHtml,$inarr2); 
if(!isset($inarr[1]) && isset($inarr2[1])) 

$inarr[1] = $inarr2[1]; 

用下面一段代碼替換上面的

Copy to ClipboardLiehuo.Net Codes引用的內容:[www.dede58.com]
//自動分析關鍵字和摘要 
preg_match("/<meta[\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr); 
preg_match("/<meta[\s]+content=['\"](.*)['\"] name=['\"]keywords['\"]/isU",$this->tmpHtml,$inarr2); 
preg_match("/<meta[\s]+name=keywords content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr3); 
if(!isset($inarr[1]) && isset($inarr2[1])) 
{ 
$inarr[1] = $inarr2[1]; 
} 
if(!isset($inarr[1]) && isset($inarr3[1])) 
{ 
$inarr[1] = $inarr3[1]; 
} 

改了上面的, 還有另一個地方需要修改的

Copy to ClipboardLiehuo.Net Codes引用的內容:[www.dede58.com]
preg_match("/<meta[\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr); 
preg_match("/<meta[\s]+content=['\"](.*)['\"] name=['\"]description['\"]/isU",$this->tmpHtml,$inarr2); 
if(!isset($inarr[1]) && isset($inarr2[1])) 
{ 
$inarr[1] = $inarr2[1]; 
} 

用下面的代碼替換掉上面的:

Copy to ClipboardLiehuo.Net Codes引用的內容:[www.dede58.com]
preg_match("/<meta[\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr); 
preg_match("/<meta[\s]+content=['\"](.*)['\"] name=['\"]description['\"]/isU",$this->tmpHtml,$inarr2); 
preg_match("/<meta[\s]+name=description content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr3); 
if(!isset($inarr[1]) && isset($inarr2[1])) 
{ 
$inarr[1] = $inarr2[1]; 
} 
if(!isset($inarr[1]) && isset($inarr3[1])) 
{ 
$inarr[1] = $inarr3[1]; 
} 

? 主站蜘蛛池模板: 邵阳市| 永城市| 来宾市| 康定县| 西畴县| 格尔木市| 康马县| 凤山市| 隆化县| 岱山县| 正安县| 西昌市| 望城县| 镇安县| 北辰区| 平罗县| 玉溪市| 崇礼县| 乌海市| 东宁县| 贺州市| 泽州县| 柯坪县| 唐河县| 姜堰市| 抚宁县| 疏附县| 肥乡县| 无棣县| 昭苏县| 潜江市| 鄂伦春自治旗| 梅州市| 海原县| 徐州市| 丹寨县| 界首市| 庆阳市| 三亚市| 桐梓县| 梁山县|