dede技巧之-dedecms的GOOGLE,Sitemap制作过程
新站一个记事本文件,把文件名改成sitemap.xml(记得后缀亦改),然后用记事本格式打开,粘贴下面的一段代码(*处用自己首页域名代替),将它上传至模板目录,比如templets/default中:
Copy code
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>http://****** </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://****** [field:typelink /]</loc>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
{/dede:channel}
{dede:arclist row=2000 orderby=pubdate}
<url>
<loc>http://****** [field:arcurl/]</loc>
<lastmod>[field:pubdate function=strftime(‘%Y-%m-%d’,@me)/]</lastmod>
<changefreq>monthly</changefreq>
</url>
{/dede:arclist}
</urlset>
其中channel row是网站的频道数量,arclist row是文章数量(可以往一个上限值设),根据实际要求更改。
2.生成sitemap.xml
前面所制作的仅是模板,现在通过dede后台的html更新>>主页更新向导来生成。在选择主页模板中填入模板路径,比如default/sitemap.xml,在主页位置填入../sitemap.xml,然后点更新主页html即可。
通过以上简单的两步,google sitemap制作完成。上传的步骤在这里就不再啰嗦了。