织梦网站地图改版完善

mac2026-08-20  2

默认的情况下,网址地图是放在如下路径下的。

站点地图的模板:templets/plus/sitemap.htm

将dede(网站后台地址)文件下makehtml_map.php中的$cfg_cmspath."/data/sitemap.html";

修改makehtml_map.php如下: 将

require_once(DEDEINC."/dedetag.class.php");

改成

require_once(DEDEINC."/arc.partview.class.php");

$dtp = new DedeTagParse(); $dtp->LoadTemplet($tmpfile); $dtp->SaveTo($cfg_basedir.$murl);

改成

$dtp = new PartView(); $GLOBALS['_arclistEnv'] = 'index'; $dtp->SetTemplet($tmpfile); $dtp->SaveToHtml($cfg_basedir.$murl);

$dtp->Clear();

改成

//$dtp->Clear();

$murl = $cfg_cmspath."/data/sitemap.html"; $tmpfile = $cfg_basedir.$cfg_templets_dir."/plus/sitemap.htm";

改成

$murl = $cfg_cmspath."/sitemap.html";//把生成的网站地图放在网站根目录下,data目录一般设置了蜘蛛不抓取 $tmpfile = $cfg_basedir.$cfg_templets_dir."/".$cfg_df_style."/sitemap.htm";//同时把网站地图模板改在默认的模板文件夹下

打开templets/plus/sitemap.htm参考如下修改

<?xml version="1.0" encoding="utf-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:mobile="http://www.baidu.com/schemas/sitemap-mobile/1/"> <url> <loc>{dede:global.cfg_basehost/}</loc> <mobile:mobile type="mobile"/> <priority>1.0</priority> <lastmod>{dede:arclist row=1 titlelen=24 orderby=pubdate}[field:pubdate function=strftime('%Y-%m-%d',@me)/]{/dede:arclist}</lastmod> <changefreq>Always</changefreq> </url> {dede:channel type='son' row='80000' typeid='1'} <url> <loc>[field:global.cfg_basehost/][field:typelink/]</loc> <mobile:mobile type="mobile"/> <changefreq>daily</changefreq> <priority>0.8</priority> </url> {/dede:channel} {dede:arclist row=5000000 orderby=pubdate} <url> <loc>[field:global.cfg_basehost/][field:arcurl/]</loc> <mobile:mobile type="mobile"/> <priority>0.6</priority> <lastmod>[field:pubdate function=strftime('%Y-%m-%d',@me)/]</lastmod> <changefreq>daily</changefreq> </url> {/dede:arclist} </urlset>
最新回复(0)