设为首页收藏本站心情墙手机版 今天是: 2024-06-18    美好的一天,从现在开始
天气与日历 切换到宽版

 找回密码
 立即注册
搜索
查看: 421|回复: 0

[帝国] 帝国cms自制网站sitemap地图(xml、txt、html)

[复制链接]
  • 打卡等级:LV7

457

主题

31

回帖

24万

积分

管理员

积分
247389

突出贡献荣誉管理论坛元老本科学士学位劳力士欧米茄奔驰宝马

QQ

皮卡丘 Lv:40
发表于 2023-4-18 19:12:44 | 显示全部楼层 |阅读模式 IP:天津
帝国sitemap如何制作?通过自定义页面自制帝国网站地图,含xml、txt、html三种格式,默认调用首页、栏目页及文章页链接
注意:xml中<mobile:mobile type="pc,mobile"/>是百度移动sitemap协议,非自适应请修改,pc删除,移动:type="mobile"
默认-sitemapXML:
  1. <?='<?xml version="1.0" encoding="UTF-8"?>'?>
  2. <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:mobile="http://www.baidu.com/schemas/sitemap-mobile/1/">
  3. <url>
  4. <loc>[!--news.url--]</loc>
  5. <mobile:mobile type="pc,mobile"/>
  6. <lastmod><?php echo date("Y-m-d H:i:s") ; ?></lastmod>
  7. <changefreq>Always</changefreq>
  8. <priority>1.00</priority>
  9. </url>
  10. [e:loop={"select * from [!db.pre!]enewsclass order by myorder",0,24,0}]
  11. <?if($bqr['classurl']==''){$sccurl=$public_r['newsurl'].$bqr['classpath']."/";}else{$sccurl=$bqr['classurl']."/";}?>
  12. <url>
  13. <loc><?=$sccurl?></loc>
  14. <mobile:mobile type="pc,mobile"/>
  15. <lastmod><?php echo date("Y-m-d H:i:s") ; ?></lastmod>
  16. <changefreq>Always</changefreq>
  17. <priority>0.80</priority>
  18. </url>
  19. [/e:loop]
  20. [e:loop={"select * from [!db.pre!]enewstags order by num DESC",0,24,0}]
  21. <url>
  22. <loc>[!--news.url--]<?echo 'tags/'.urlencode($bqr['tagname']).'/';?></loc>
  23. <mobile:mobile type="pc,mobile"/>
  24. <lastmod><?php echo date("Y-m-d H:i:s") ; ?></lastmod>
  25. <changefreq>Always</changefreq>
  26. <priority>0.60</priority>
  27. </url>
  28. [/e:loop]
  29. [e:loop={"select * from [!db.pre!]ecms_news order by newstime desc",0,24,0}]
  30. <url>
  31. <loc><?=$bqsr[titleurl]?></loc>
  32. <mobile:mobile type="pc,mobile"/>
  33. <lastmod><?=date('Y-m-d H:i:s',$bqr[newstime])?></lastmod>
  34. <changefreq>Always</changefreq>
  35. <priority>0.60</priority>
  36. </url>
  37. [/e:loop]
  38. </urlset>
复制代码

默认-sitemapTXT:
  1. [!--news.url--]
  2. [e:loop={"select * from [!db.pre!]enewsclass order by myorder",0,24,0}]
  3. <?if($bqr['classurl']==''){$sccurl=$public_r['newsurl'].$bqr['classpath']."/";}else{$sccurl=$bqr['classurl']."/";}?>
  4. <?=$sccurl?>
  5. [/e:loop]
  6. [e:loop={"select * from [!db.pre!]enewstags order by num DESC",0,24,0}]
  7. [!--news.url--]<?echo 'tags/'.urlencode($bqr['tagname']).'/';?>
  8. [/e:loop]
  9. [e:loop={"select * from [!db.pre!]ecms_news order by newstime desc",0,24,0}]
  10. <?=$bqsr[titleurl]?>
  11. [/e:loop]
复制代码


默认-sitemapHTML:
注意栏目标题调用的是别名,栏目名称用<?=$bqr['classname']?>
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>站点地图 - <?=$public_r['sitename']?></title>
  5. </head>
  6. <body>
  7. <a href="[!--news.url--]" title="<?=$public_r['sitename']?>"><?=$public_r['sitename']?></a><br>
  8. [e:loop={"select * from [!db.pre!]enewsclass order by myorder",0,24,0}]
  9. <?if($bqr['classurl']==''){$sccurl=$public_r['newsurl'].$bqr['classpath']."/";}else{$sccurl=$bqr['classurl']."/";}?>
  10. <a href="<?=$sccurl?>" title="<?=$bqr['bname']?>"><?=$bqr['bname']?></a><br>
  11. [/e:loop]
  12. [e:loop={"select * from [!db.pre!]enewstags order by num DESC",0,24,0}]
  13. <a href="[!--news.url--]<?echo 'tags/'.urlencode($bqr['tagname']).'/';?>" title="<?=$bqr[tagtitle]?>"><?=$bqr[tagtitle]?></a><br>
  14. [/e:loop]
  15. [e:loop={"select * from [!db.pre!]ecms_news order by newstime desc",0,24,0}]
  16. <a href="<?=$bqsr[titleurl]?>" title="<?=$bqr[title]?>"><?=$bqr[title]?></a><br>
  17. [/e:loop]
  18. </body>
  19. </html>
复制代码




自定页页面链接调用:

提示:where id!=1 and id!=2 and id!=3可排除不需要调用的自定义页面

XML(粘贴至默认map的</urlset>上面):
  1. [e:loop={'select id,path,title from [!db.pre!]enewspage where id!=1 and id!=2 and id!=3 order by id',0,24,0}]
  2. <?php $pageurl=$public_r['newsurl'].str_replace('../../','',$bqr['path']);?>
  3. <url>
  4. <loc><?=$pageurl?></loc>
  5. <mobile:mobile type="pc,mobile"/>
  6. <lastmod><?php echo date("Y-m-d H:i:s") ; ?></lastmod>
  7. <changefreq>Always</changefreq>
  8. <priority>0.60</priority>
  9. </url>
  10. [/e:loop]
复制代码


TXT(粘贴至默认map的尾部):
  1. [e:loop={'select id,path,title from [!db.pre!]enewspage where id!=1 and id!=2 and id!=3 order by id',0,24,0}]
  2. <?php $pageurl=$public_r['newsurl'].str_replace('../../','',$bqr['path']);?>
  3. <?=$pageurl?>
  4. [/e:loop]
复制代码


HTML(粘贴至默认map的</body>上面):

  1. [e:loop={'select id,path,title from [!db.pre!]enewspage where id!=1 and id!=2 and id!=3 order by id',0,24,0}]
  2. <?php $pageurl=$public_r['newsurl'].str_replace('../../','',$bqr['path']);?>
  3. <a href="<?=$pageurl?> " title="<?=$bqr[title]?>"><?=$bqr[title]?></a><br/>
  4. [/e:loop]
复制代码





专题链接调用:
xml(粘贴至默认map的</urlset>上面):
  1. [e:loop={"select * from [!db.pre!]enewszt order by ztid",0,24,0}]
  2. <?if($bqr['zturl']==''){$sccurl=$public_r['newsurl'].$bqr['ztpath']."/";}else{$sccurl=$bqr['zturl']."/";}?>
  3. <url>
  4. <loc><?=$sccurl?></loc>
  5. <lastmod><?php echo date("Y-m-d H:i:s") ; ?></lastmod>
  6. <changefreq>daily</changefreq>
  7. <priority>0.6000</priority>
  8. </url>
  9. [/e:loop]
复制代码


txt(粘贴至默认map的尾部):
  1. [e:loop={"select * from [!db.pre!]enewszt order by ztid",0,24,0}]
  2. <?if($bqr['zturl']==''){$sccurl=$public_r['newsurl'].$bqr['ztpath']."/";}else{$sccurl=$bqr['zturl']."/";}?>
  3. <?=$sccurl?>
  4. [/e:loop]
复制代码


html(粘贴至默认map的</body>上面):
  1. [e:loop={"select * from [!db.pre!]enewszt order by ztid",0,24,0}]
  2. <?if($bqr['zturl']==''){$sccurl=$public_r['newsurl'].$bqr['ztpath']."/";}else{$sccurl=$bqr['zturl']."/";}?>
  3. <a href="<?=$sccurl?>" title="<?=$bqr[classname]?>"><?=$bqr[classname]?></a><br>
  4. [/e:loop]
复制代码





急躁,是因为经历不够,轻浮,是因为磨练不够,烦乱,是因为思路不清,压力,是因为格局不够,恐惧,是因为假想太多,在这个薄凉的世界,自己不强大,一切都是浮云 ...
懒得打字嘛,点击右侧快捷回复 【乱回复纯数字纯字母将禁言】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|社区规范|绵羊优创 ( 京ICP备19037745号-2 )|网站地图

公安备案京公网安备11011502037529号

GMT+8, 2024-6-18 23:10 , Processed in 1.427208 second(s), 19 queries , MemCache On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表