織夢DEDE采集沒有自動生成摘要和關鍵詞的解決辦
導讀:織夢技術織夢技術織夢DedeCMS網站采集沒有自動生成摘要和關鍵詞的解決辦法: 織夢5.6采集到了內容,可沒有自動生成摘要和關鍵字,關鍵字和摘要都是空的。 可能很多人都遇到了和織夢的模板模板織夢。
織夢DedeCMS網站采集沒有自動生成摘要和關鍵詞的解決辦法:
織夢5.6采集到了內容,可沒有自動生成摘要和關鍵字,關鍵字和摘要都是空的。
可能很多人都遇到了和我們一樣的問題,在論壇實在沒找到好的解決辦法,就自己動手去改改文件。廢話不多說了。
下面是我的解決辦法:
比如我采集了網站:http://www.5loveb.com
首頁的meta代碼是:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>織夢模板_dede模板|織夢模板下載|織夢企業模板 -專注織夢模板設計制作</title>
<meta name="keywords" content="專注織夢模板設計制作!提供精品織夢DedeCMS模板下載,分享各種素材資源,技術教程等信息。" />
<meta name="description" content="dede模板,織夢模板,織夢模板下載,dedecms,織夢企業模板" />
如果用dedecms的采集的時候就沒有辦法自動獲取description和keywords的值的。
大家注意到了這段代碼和其它網站的區別了沒??
<meta name=description content=... />
<meta name=keywords content=... />
就是name="description" 和 name="keywords" 少了雙引號""
這個可能是dedecms中自動分析關鍵字和摘要的一個bug吧,沒有考慮到<meta name=keywords content ='' />這種情況!
采集的選項dede下瓻模板下載里面也沒有自己填寫關鍵字和摘要的選項。那我只能自己動手修改文件了。
1、修改 include/dedecollection.class.php 內容來源:
//自動分析關鍵字和摘要
preg_match("/<meta[\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr);
preg_match("/&dede模板下載lt;meta[\s]+content=['\"](.*)['\"] name=['\"]keywords['\"]/isU",$this->tmpHtml,$inarr2);
if(!isset($inarr[1]) && isset($inarr2[1]))
{
$inarr[1] = $inarr2[1];
}
用下面一段代碼替換上面的
//自動分析關鍵字和摘要
preg_match("/<me織夢模板ta[\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];
}
改了上面的,還有另一個地方需要修改的
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];
}
用下面的代碼替換掉上面的:
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];
}相關織夢的模板模板織夢。
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-07-22 ,文章織夢DEDE采集沒有自動生成摘要和關鍵詞的解決辦主要講述解決辦法,自動生成,織夢網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_34445.html