欧美日韩国产精选国产永久在线入口|久久精品无码av色色丁香婷婷五月|欧美伊人网91天天视频色板一区|啪啪激情五月天国产高清一卡二卡|激情五月天丁香高清有码无码中文|高清无码免费在线看免费黄片|蜜桃亚洲 无码二区三区黄色网|人人叉人人爽日美黄色视频

新聞中心

discuz如何制作門戶的百度sitemap

作者 / 無憂主機 時間 2016-02-17 01:24:43

大家都知道,搜索引擎蜘蛛進入網(wǎng)站它會首先檢查該站點根目錄下是否存在robots.txt,如果存在,搜索機器人就會按照該文件中的內(nèi)容來確定訪問的范圍;如果該文件不存在,就會找該站點的網(wǎng)站地圖進行爬行。所以網(wǎng)站地圖對于搜索引擎來說也是非常重要的一個文件。一般來說,搜索引擎蜘蛛爬行網(wǎng)站的深度不會太深,如果你的網(wǎng)站權(quán)重不高的話,最多蜘蛛爬行3層就算很不錯了,如果你的網(wǎng)站內(nèi)容很多,3層還展示不完,那就只有通過網(wǎng)站地圖來告訴搜索引擎,讓蜘蛛更加精準的了解你的網(wǎng)站內(nèi)容有多少,并且通過網(wǎng)站地圖蜘蛛會抓取更深一些的欄目頁面,這也說明了網(wǎng)站地圖的存在價值和重要性。根據(jù)以上介紹應該都對百度sitemap有一定的了解了。那么discuz如何制作門戶的百度sitemap方法有兩種:第一種是最常見的通過插件來實現(xiàn),但是插件會增加獨立ip空間的負擔。所以無憂主機小編極力推薦第二種方法。 discuz如何制作門戶的百度sitemap 制作思路:百度sitemap可以提交xml文件,所以我們可以利用discus內(nèi)置的rss來實現(xiàn)。 1、文本編輯器(editplus)打開文件根目錄下:portal.php 查找:

if(empty($_GET['mod']) || !in_array($_GET['mod'], array('list', 'view', 'comment', 'portalcp', 'topic', 'attachment', 'rss', 'block'))) $_GET['mod'] = 'index';
修改為:
if(empty($_GET['mod']) || !in_array($_GET['mod'], array('list', 'view', 'comment', 'portalcp', 'topic', 'attachment', 'rss', 'block', 'sitemap'))) $_GET['mod'] = 'index';
2、文件目錄:source/module/portal/portal_rss.php復制一份,將該文件重新命名為:portal_sitemap.php 3、文本編輯器(editplus)打開文件:portal_sitemap.php 1、查找:
echo "<?xml version=\"1.0\" encoding=\"".$charset."\"?>\n".
"<rss version=\"2.0\">\n".
" <channel>\n".
(count($catarray) > 1 ?
" <title>{$_G[setting][bbname]}</title>\n".
" <link>{$_G[siteurl]}forum.php</link>\n".
" <description>Latest $num articles of all categories</description>\n"
:
" <title>{$_G[setting][bbname]} - $catname</title>\n".
" <link>{$_G[siteurl]}portal.php?mod=list&catid=$rsscatid</link>\n".
" <description>Latest $num articles of $catname</description>\n"
).
" <copyright>Copyright(C) {$_G[setting][bbname]}</copyright>\n".
" <generator>discuz! Board by Comsenz Inc.</generator>\n".
" <lastBuildDate>".gmdate('r', TIMESTAMP)."</lastBuildDate>\n".
" <ttl>$ttl</ttl>\n".
" <image>\n".
" <url>{$_G[siteurl]}static/image/common/logo_88_31.gif</url>\n".
" <title>{$_G[setting][bbname]}</title>\n".
" <link>{$_G[siteurl]}</link>\n".
" </image>\n";
修改為:
echo "<?xml version=\"1.0\" encoding=\"".$charset."\"?>\n".
" <urlset>\n";
2、查找:
echo " <item>\n".
" <title>".$article['subject']."</title>\n".
" <link>$_G[siteurl]".($rewriteflag ? rewriteoutput('portal_article', 1, '', $article[aid]) : "portal.php?mod=view&aid=$article[aid]")."</link>\n".
" <description><![CDATA[".dhtmlspecialchars($article['description'])."]]></description>\n".
" <category>".dhtmlspecialchars($article['catname'])."</category>\n".
" <author>".dhtmlspecialchars($article['author'])."</author>\n".
($attachfile ? '<enclosure url="'.$filename.'" length="'.$attachsize.'" type="image/jpeg" />'."\n" : '').
" <pubDate>".gmdate('r', $article['dateline'])."</pubDate>\n".
" </item>\n";
修改為
echo " <url>\n".
" <loc>$_G[siteurl]".($rewriteflag ? rewriteoutput('portal_article', 1, '', $article[aid]) : "portal.php?mod=view&aid=$article[aid]")."</loc>\n".
" <lastmod>".date('Y-m-d', $article['dateline'])."</lastmod>\n".
" <changefreq>daily</changefreq>\n".
" <priority>1.0</priority>\n".
" </url>\n";
找到
echo " </channel>\n".
"</rss>";
修改為:
echo " </urlset>\n";
//注釋:注意顯示條數(shù),可以修改portal_sitemap.php這里:$num = 20; 程序默認是顯示20條,可根據(jù)自己的需要更改。 總結(jié):通過以上方法修改后,訪問站點地址例如:www.xxxx.com/portal.php?mod=sitemap,即可看到效果。百度sitemap提交這個地址即可。 無憂主機相關(guān)文章推薦閱讀: DISCUZ可以讓會員頭像使用高清大圖嗎 DISCUZ美化:如何去除導讀中最新發(fā)表 DISCUZ教程怎樣刪除會員資料下的QQ交談圖標

本文地址:http://www.love62.cn/discuz/21652.html

1
1
1
1
1
1
1

客戶服務熱線

0791-8623-3537

在線客服