DEDE采集時自動生成摘要和關鍵字,dedecms
導讀:dedecmsdedecms最近在學習織夢CMS的采集功能,在采集的過程我總是發現織夢5.6可以采集到內容,但不可自動生成摘要和關鍵字,關鍵字和摘要都是空的。dede免費校板下戰夢織模板。
最近在學習織夢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=['\"](.*)['\"dede網站模板]/isUdede商城模板",$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]; }
用下面的代碼替換掉上面的:
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-07-21 ,文章DEDE采集時自動生成摘要和關鍵字,dedecms主要講述自動生成,摘要,dedecms網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_32771.html
為你推薦與DEDE采集時自動生成摘要和關鍵字,dedecms相關的文章
