婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 網站建設 > 建站知識 > DEDE采集時自動生成摘要和關鍵字

DEDE采集時自動生成摘要和關鍵字

POST TIME:2020-03-28 23:54

最近在學習織夢CMS的采集功能,在采集的過程我總是發現織夢5.6可以采集到內容,但不可自動生成摘要和關鍵字,關鍵字和摘要都是空的。感覺很遺憾,怎么辦呢?

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

下面是我的解決辦法

比如我采集了網站:http://www.genban.org

首頁的meta代碼是:

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>一條龍建站 - 建站服務,建站教程,新云建站教程,織夢建站教程,CMS建站教程</title>
<meta name="description" content="一個綜合建站教程、建站經驗交流、織夢CMS建站技巧、CMS建站模板的站長教程網。" />
<meta name="keywords" content="建站教程,織夢建站教程,CMS建站教程" />

如果用織夢模板的采集的時候就沒有辦法自動獲取description和keywords的值的。

1、修改 include/dedecollection.class.php

//自動分析關鍵字和摘要
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];
}

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

//自動分析關鍵字和摘要
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];
}

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

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];
}

重新上傳,大功告成。記得覆蓋的時候一定要備份哦。



收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266
主站蜘蛛池模板: 水富县| 大同市| 汝州市| 福海县| 荔浦县| 陆丰市| 丁青县| 无棣县| 荔波县| 公安县| 绿春县| 海盐县| 肥城市| 诸城市| 新丰县| 贺兰县| 棋牌| 平阳县| 武平县| 宝山区| 全南县| 靖安县| 嘉定区| 开远市| 体育| 陇川县| 乌拉特前旗| 勐海县| 宜兴市| 开江县| 南投县| 绵阳市| 贵南县| 牙克石市| 淳化县| 江川县| 中宁县| 宜兰市| 新沂市| 民和| 青川县|