当前位置:首页 > 行业动态 > 正文

如何提高织梦dedecms后台文章在百度的收录和排名?

在织梦dedecms后台,通过优化文章标题、关键词及描述标签,提高内容质量与更新频率,可提升百度收录排名。

在织梦CMS(DedeCMS)中,通过一些插件和代码的修改,可以实现后台文章百度收录排名的开发,以下是详细的开发教程:

第一步:准备工作

需要准备两个PHP文件inc_baidu.phpext_baidu.php,这些文件将用于实现与百度搜索API的交互逻辑。

第二步:放置文件

1、inc_baidu.php文件放入后台根目录的inc文件夹内

2、ext_baidu.php文件放入后台根目录

第三步:修改模板文件

templets模版文件夹中的content_list.htm文件中添加以下代码:

<a href="javascript:getBaiduRanking(0)" class="coolbg"> 百度排名 </a>
<a href="javascript:getBaiduShoulu(0)" class="coolbg"> 百度收录 </a>
<a href="javascript:getBaiduZhonghe(0)" class="coolbg"> 百度综合 </a>

第四步:修改JavaScript文件

编辑后台根目录下的js文件夹中的list.js文件,添加以下函数:

//百度排名
function getBaiduRanking(aid){
    var qstr=getCheckboxItem();
    if(aid==0) aid = getOneItem();
    if(qstr=='') {
        alert('必须选择一个或多个文档!');
        return;
    }
    location="ext_baidu.php?aid="+aid+"&dopost=BaiduRanking&qstr="+qstr;
}
//百度收录
function getBaiduShoulu(aid){
    var qstr=getCheckboxItem();
    if(aid==0) aid = getOneItem();
    if(qstr=='') {
        alert('必须选择一个或多个文档!');
        return;
    }
    location="ext_baidu.php?aid="+aid+"&dopost=BaiduShoulu&qstr="+qstr;
}
//百度收录排名 综合查询
function getBaiduZhonghe(aid){
    var qstr=getCheckboxItem();
    if(aid==0) aid = getOneItem();
    if(qstr=='') {
        alert('必须选择一个或多个文档!');
        return;
    }
    location="ext_baidu.php?aid="+aid+"&dopost=BaiduZhonghe&qstr="+qstr;
}

第五步:配置inc_baidu.php文件

inc_baidu.php文件中,添加以下代码,用于获取文章标题和网址:

<?php
require_once(dirname(__FILE__).'/../config.php');
require_once(DEDEADMIN.'/inc/inc_batchup.php');
require_once(DEDEADMIN.'/inc/inc_archives_functions.php');
require_once(DEDEINC.'/typelink.class.php');
require_once(DEDEINC.'/arc.archives.class.php');
//得到标题
function getTitle($aid) {
    $aid = preg_replace("#[^09]#", '', $aid);
    $Archives = new Archives();
    $arcQuery = "SELECT title FROMxjq_archives WHERE id='$aid' ";
    $arcRow = $Archives>dsql>GetOne($arcQuery);
    $title = $arcRow['title'];
    return $title;
}
//得到网址
function getUrl($aid) {
    $aid = preg_replace("#[^09]#", '', $aid);
    $Archives = new Archives();
    $query = "SELECT arc.*,ch.maintable,ch.addtable,ch.issystem,ch.editcon,tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl FROMxjq_arctiny arc LEFT JOINxjq_arctype tp ON tp.id=arc.typeid LEFT JOINxjq_channeltype ch ON ch.id=tp.channel WHERE arc.id='$aid' ";
    $trow = $Archives>dsql>GetOne($query);
    $trow['maintable'] = ( trim($trow['maintable'])=='' ? 'xjq_archives' : trim($trow['maintable']) );
    if($trow['issystem'] != 1) {
        $arcQuery = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl FROM{$trow['maintable']} arc LEFT JOINxjq_arctype tp on tp.id=arc.typeid LEFT JOINxjq_channeltype ch on ch.id=tp.channel WHERE arc.id='$aid' ";
        $arcRow = $Archives>dsql>GetOne($arcQuery);
        $arcRow['id'] = $arcRow['id'];
        $arcRow['typeid'] = $arcRow['typeid'];
        $arcRow['senddate'] = $arcRow['senddate'];
        $weburl = $cfg_phpurl . '/view.php?aid=' . $aid;
        return $weburl;
    }
}
?>

FAQs

问题一:如何查看文章是否已经被百度收录?

答:在织梦CMS后台,可以通过点击“百度收录”链接来查询文章是否被百度收录,如果未被收录,系统会提示相应的信息。

问题二:如何提高文章在百度中的排名?

答:要提高文章在百度中的排名,可以从以下几个方面入手:优化文章的标题和内容,确保其包含相关关键词;定期更新网站内容,保持网站的活跃度;使用主动推送功能,将新发布的文章及时提交给百度,以加快收录速度。

0