百度(Google)对已提交的数据,不保证一定会抓取及索引所有网址。但是,百度(Google)会使用sitemap中的数据来了解网站的结构等信息,这样可以帮助百度改进抓取策略,并在日后能更好地对网站进行抓取。此外,sitemap与搜索排名没有关系。
生成的路径是在/data目录下,我们一般放在根目录下,所以更改一下文件:
方法如下:
第一步:打开/dede/makehtml_map.php
if($dopost=="site")
{
$murl = $cfg_cmspath."/data/sitemap.html"; //内容来自织梦模板团
$tmpfile = $cfg_basedir.$cfg_templets_dir."/plus/sitemap.htm";
}
更改成为
if($dopost=="site")
{
$murl = $cfg_cmspath."/sitemap.html";
$tmpfile = $cfg_basedir.$cfg_templets_dir."/plus/sitemap.htm";
}
这样就实现了sitemap.html放在根目录的的任务了Sitemap的模板文件是\templets\plus\sitemap.htm,通过修改可以定义样式
二.织梦DEDECMS sitemap.xml的制作
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>{dede:global.cfg_basehost/}</loc>
<lastmod>{dede:arclist row=1 titlelen=24 orderby=pubdate}
[field:pubdate function=strftime('%Y-%m-%d',@me)/]
{/dede:arclist}</lastmod>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>
{dede:channel row='1000' type='top'}
<url>
<loc>[field:typelink /]</loc>
<changefreq>daily</changefreq>
<priority>0.9</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>
<priority>0.8</priority>
</url>
{/dede:arclist}
</urlset>
将上面这个文件保存成一个模板文件如gsitemap.htm,放在模板目录下如templets/plus下。
然后织梦后台操作
里增加一个列表
按上图设置,注意的是,“不限”那里先随便选择,保存后再修改成“不限”,然后“更新”,生成文件。
这里有两个问题:
2.生成好多个sitemap.xml,这个问题如下图更改
至此织梦中html和xml格式的网站地图就生成了。
