K9 通用版 博客版 主题版 地方门户版 企业版 |   企业(ASP) 分类 使用 分享 疑问 模板 建议 帮助 错误 其他
+新建主题 [Ajax]
填写帐号密码即可完成注册
+新建话题 最新回复排序 最新主题排序 精华帖子

自认完美的sitemap的生成

12Next >

ykmjchen 发表于:12-07-17 15:04 [添加收藏] 楼主 [回复] #Top#
ykmjchen 人气:20 积分:144 金币:726

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

外模板源码(文件名: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

1064) 数据查询错误:syntax error, unexpected '-'
laoguang 发表于:12-07-17 15:37 沙发 [回复] #Top#
laoguang 人气:80 积分:130 金币:789
初略看,不错,包含单页么
2678389407 发表于:12-07-19 21:17 板凳 [回复] #Top#
2678389407 人气:12 积分:137 金币:54
确实不错啊
laoguang 发表于:12-07-21 00:03 4楼 [回复] #Top#
laoguang 人气:80 积分:130 金币:789
这么简单的一个页面,就完全没必要分内外模板了,我把内外模板合并了
<?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:portal.list listid1='0' listid!='1' } <!--单页,listid!='1'不显示栏目-->
       <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} 
</urlset>
laoguang 发表于:12-07-21 00:04 5楼 [回复] #Top#
laoguang 人气:80 积分:130 金币:789
包含单页的,很好用,谁用谁知道,难得的技术贴啊
ykmjchen 发表于:12-07-23 09:39 6楼 [回复] #Top#
ykmjchen 人气:20 积分:144 金币:726
分内外模板我个人觉得有他的好处,可以针对不同的搜索引擎做 呵呵
在做这个文件的时候 我也想过就用外模板。
dskiller 发表于:12-07-23 14:52 7楼 [回复] #Top#
dskiller 人气:1 积分:187 金币:132
围观一下
jumpsky 发表于:12-09-19 12:14 9楼 [回复] #Top#
jumpsky 人气:30 积分:274 金币:710
楼主和4楼的都很精彩 我收藏了  等下午弄自己站试试
275280473 发表于:12-12-26 13:49 10楼 [回复] #Top#
275280473 人气:0 积分:110 金币:410
围观一下
shayang123 发表于:13-01-10 20:57 12楼 [回复] #Top#
shayang123 人气:10 积分:73 金币:80
过来看一下

12Next >

发表回复

帐号 匿名发布 审核后可见 [加载完整在线编辑器]
内容
验证码
KingCMS 内容管理系统

关于我们 联系我们 广告报价 付款方式 站点导航

Copyright © 2004-2015 Focuznet All rights reserved.

广州唯众网络科技有限公司 粤ICP备08008106号

中奖了!