dedecms制作网站地图的方法
dedecms生成xml地图的方法有好几个,也有插件。但是有的时候不知道什么原因用不了,我今天试又不行,所以在网上重新找了一个方法,这个方法更加简单。
制作思路
通过dedecms生成单页面的功能,只要制作好一个xml的模板,就能生成xml地图文件
步骤
制作模板
制作一个xml地图模板文件,一般命名为:sitemap.htm,然后把以下代码放置模板文件即可:
1. <?xml version="1.0" encoding="UTF-8" ?>
2. <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
3. xmlns:mobile="http://www.baidu.com/schemas/sitemap-mobile/1/">
4. <url>
5. <loc>{dede:global.cfg_basehost/}</loc>
6. <lastmod>{dede:arclist row=1 titlelen=24 orderby=pubdate}[field:pubdate function=strftime('%Y-%m-%d',@me)/]{/dede:arclist}</lastmod>
7. <changefreq>always</changefreq>
8. <priority>1.0</priority>
9. </url>
10. {dede:channel row=’1000′ type=’top’}
11. <url>
12. <loc>[field:typelink /]</loc>
13. <changefreq>daily</changefreq>
14. <priority>0.9</priority>
15. </url>
16. {/dede:channel}
17. {dede:arclist row=2000 orderby=pubdate typeid=1}
18. <url>
19. <loc>[field:arcurl/]</loc>
20. <lastmod>[field:pubdate function=strftime('%Y-%m-%d',@me)/]</lastmod>
21. <changefreq>monthly</changefreq>
22. <priority>0.8</priority>
23. </url>
24. {/dede:arclist}
25. </urlset>
将文件上传到/templets/default/目录下即可。
生成页面
点击
织梦后台——核心——频道模型里面的单页文档管理
增加一个页面,参考如下设置
弄好之后,更新这个页面就可以更新xml地图了,文件为网站更目录下sitemap.xml文件
还可以在robots中添加。