织梦本身有sitemap.xml创建功能,不过不太用,而且太乱太杂,不好用,下面介绍的纯代码创建符合百度收录标准的xml网站地图sitemap!
步骤如下:
1、创建sitemap.xml文件,并放入模板文件夹中,sitemap.xml里面的代码为:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | <? xml version = "1.0" encoding = "utf-8" ?> < urlset xmlns = "http://www.sitemaps.org/schemas/sitemap/0.9" > < url > < loc >http://yourdomain</ 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 > < url > < loc >http://yourdomain/sitemap.xml</ loc > < lastmod >{dede:arclist row=1 titlelen=24 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 >http://yourdomain{dede:field name='typeurl'/}</ loc > < changefreq >daily</ changefreq > < priority >0.6</ priority > </ url > {/dede:channel} {dede:arclist row=1000 orderby=id} < url > < loc >http://yourdomain[field:arcurl/]</ loc > < lastmod >[field:pubdate function=strftime('%Y-%m-%d',@me)/]</ lastmod > < changefreq >weekly</ changefreq > < priority >0.8</ priority > </ url > {/dede:arclist} </ urlset > |
创建好文件之后,把sitemap.xml放入模板文件夹中。
温馨提示:记得把yourdomain改为自己的网址哦!
2、接着更新网站首页,设置如下图:
方法很简单,方便修改,广大织梦CMS爱好者记得多分享哦!