織夢實時推送sitemap地址給百度,最新版本的織夢百
導讀:織夢文章織夢文章很久前,織夢自己有一套主動ping百度的插件,但是后來好像有幾年用不了了. 最近百度除了實時推送鏈接的地址,這樣肯定比sitemap方便多了.而且也可以確保文章夢織模板。
很久前,織夢自己有一套主動ping百度的插件,但是后來好像有幾年用不了了.
最近百度推出了實時推送鏈接地址給百度,這樣肯定比sitemap方便多了.而且也可以確保文章的原創性.
不知道為什么我在網上還沒看到織夢有這樣的教程,所以我就根據百度接口寫了個教程出來,給各位織夢愛好者看看.
關于織夢的百度實時推送我寫了兩種方法,大家可以自行選擇:
1、
手動創建一個文件,每天訪問這個文件就可以把當天的全部文章推送到百度搜索引擎.
在根目錄下面創建一個fcz8k.php 訪問后會返回百度接口結果
代碼如下
<?php require_once ("include/common.inc.php"); require_once "include/arc.partview.class.php"; require_once('include/charset.func.php'); $year = date("Y"); $month = date("m"); $day = date("d"); $dayBegin = mktime(0,0,0,$month,$day,$year);//當天開始時間戳 $dayEnd = mktime(23,59,59,$month,$day,$year);//當天結束時間戳 $query = "SELECT arch.id,types.typedir FROM dede_arctype as types inner join dede_archives as arch on types.id=arch.typeid where pubdate<".$dayEnd." AND pubdate>".$dayBegin.""; //這里dede換成你們自己的表前綴 $urls=""; $dsql->Execute('arch.id,types.typedir',$query); while($row = $dsql->GetArray('arch.id,types.typedir')) { $urls.="http://www.genban.org".str_replace("{cmspath}","",$row['typedir'])."/".$row[id].".html".","; //將上邊的http://www.genban.org換成你的網址 } $urls=substr($urls,0,-1); $urls = explode(",",$urls); $api = 'http://data.zz.baidu.com/urls?site=www.genban.org&token=xxxxx'; // 前邊的site換成自己的site xxx換成自己的密鑰 $ch = curl_init(); $options = array( CURLOPT_URL => $api, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => implode("\n&qudede模板安裝ot;, $urls), CURLOPT_HTTPHEADER => array('Content-Type: text/plain'), ); curl_setopt_array($ch, $options); $result = curl_exec($ch); echo $result.count($urls); ?> 百度接口返回說明:
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-07-19 ,文章織夢實時推送sitemap地址給百度,最新版本的織夢百主要講述最新版本,實時,織夢網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_30016.html