
歡迎訪問全國企業網站設計NO.1網站開發商平臺 | 付款方式 |
POST TIME:2020-10-09
在一個網站中網站地圖是不能少的,有網站地圖不僅可以提升網站瀏覽者的用戶體驗,還可以讓蜘蛛更好的抓取網站,讓網站有一個更好的收錄和排名。
織夢制作xml網站地圖的方法步驟:
第一步:分別打開/dede/inc/inc_menu.php和/dede/inc/inc_menu_map.php文件
找到 <m:item name='更新主頁HTML' link='makehtml_homepage.php' rank='sys_MakeHtml' target='main' />
修改為:
<m:item name='更新Sitemap' link='makehtml_sitemap.php' rank='sys_MakeHtml' target='main' />
第二步:制作dede/makehtml_sitemap.php文件
拷貝一個dede/makehtml_homepage.php文件
找到$pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet); $pv->SaveToHtml($homeFile);
這段代碼直接刪除,底部修改調用生成文件模板為makehtml_sitemap.htm,然后另存為makehtml_sitemap.php,上傳至dede/即可。
第三步:制作后臺更新模板文件dede/templets/makehtml_sitemap.htm
拷貝一個dede/templets/makehtml_homepage.htm文件
找到
<input name="templet" type="text" id="templet" style="width:300″ value="<?php echo $row['templet']?>">
修改為:
<input name="templet" type="text" id="templet" style="width:300″ value="default/sitemap.xml">
找到
<td height="20″ valign="top" bgcolor="#FFFFFF"><input name="position" type="text" id="position" value="<?php echo $row['position']?>" size="30″>
修改為:
<td height="20″ valign="top" bgcolor="#FFFFFF"><input name="position" type="text" id="position" value="../sitemap.xml" size="30″>
然后另存為makehtml_sitemap.htm,上傳至dede/templets/;
第四步:制作sitemap模板文件,即templets/sitemap.xml
將一下代碼保存為sitemap.xml即可
<?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet type="text/xsl" href="/templets/css/sitemap.xsl"?><!-- generator="dedecms/3.2" -->
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>http://www.織夢58dede58.comm</loc>
<lastmod>
{dede:arclist row=1 titlelen=30 orderby=pubdate}
[field:pubdate function=strftime('%Y-%m-%d',@me)/]
{/dede:arclist}
</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
{dede:channel row='30' type='top'}
<url>
<loc>[field:typelink /]</loc>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
{/dede:channel}
{dede:arclist row=2000 orderby=pubdate}
<url>
<loc>[field:arcurl/]</loc>
<lastmod>[field:pubdate function=strftime('%Y-%m-%d',@me)/]</lastmod>
<changefreq>monthly</changefreq>
</url>
{/dede:arclist}
</urlset>