自认完美的sitemap的生成

添加日期:2012-09-26  点击量:0

采用系统原有的内外模板生成机制,建立相应的模板。

外模板源码(文件名:sitemap.xml):

<?php echo '<?xml version="1.0" encoding="UTF-8" ?'; echo '>'; ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.sitemaps.org/schemas/sitemap-image/1.1">

{king:inside/}


</urlset>



内模板源码,(文件名:sitemap.xml):


{king:portal.list listid1='0' listid!='22' } <!--listid!='22'不显示栏目-->
<url>
<loc>{config:system.siteurl/}{king:listpath/}</loc>
<lastmod><? echo date("Y-m-d"); ?></lastmod>
<changefreq>daily</changefreq> <!--always,hourly,daily,weekly,monthly,yearly-->
<priority>1.0</priority>
</url>
{/king:portal.list}

{king:dbquery query="select kpath,nlastdate,ndate,kimage from %s__product"}
<url>
<loc>{config:system.siteurl/}/{king:kpath/}</loc>
<image:image>
<image:loc>{config:system.siteurl/}/{king:kimage/}</image:loc>
</image:image>
<lastmod>{king:nlastdate formatdate="Y-m-d"/}</lastmod>
<changefreq>daily</changefreq> <!--always,hourly,daily,weekly,monthly,yearly-->
<priority>0.9</priority>
</url>
{/king:dbquery}

{king:dbquery query="select kpath,nlastdate,ndate from %s__article"}
<url>
<loc>{config:system.siteurl/}/{king:kpath/}</loc>
<lastmod>{king:nlastdate formatdate="Y-m-d"/}</lastmod>
<changefreq>daily</changefreq> <!--always,hourly,daily,weekly,monthly,yearly-->
<priority>0.8</priority>
</url>
{/king:dbquery}



设置生成文件包括xml格式,设置方法: 后台-》工具-》网站参数设置-》主系统-》可支持的模板扩展名 设置为:htm|html|shtml|xml

建立一个单页面栏目,必须设置为生成html,内外部模版选择上面建立的模版:sitemaps.xml,生成文件名字设置为:sitemaps.xml

相关内容