聆听风声 点点滴滴都很珍贵!

DEDECMS制作网站地图

2018-03-17

![请输入图片描述][1]

  • 首先我们需要建立一个记事本,命名为sitemap.xml后保存。
  • 将我提供的代码拷贝到记事本里,然后保存。
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>http://127.0.0.1/</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='23' type='top'}
<url>
<loc>http://127.0.0.1[field:typelink /]</loc>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
{/dede:channel}
{dede:arclist row=2000 orderby=pubdate}
<url>
<loc>http://127.0.0.1[field:arcurl/]</loc>
<lastmod>[field:pubdate function=strftime('%Y-%m-%d',@me)/]
</lastmod>
<changefreq>monthly</changefreq>
</url>
{/dede:arclist}
</urlset>
  • 将sitemap.xml文件上传到根目录/templets/default里。
  • 然后登陆网站后台更新网站首页即可,如下图设置更新。
    • 把代码里的127.0.0.1的URL改成你自已的就可以了。
    • 在更新的时候把里面的index.htm与index.html改成sitemap.xml 在更新,在更新完毕后将改回原来设置(sitemap.xml改成index.html)

验证网站SiteMap的在线工具: http://www.xmlvalidation.com/ [1]: http://pic1.codeinfo.top/typora/\%E9\%BB\%98\%E8\%AE\%A4\%E6\%96\%87\%E4\%BB\%B61590651068439.jpg


Comments

Content