|
帝国sitemap如何制作?通过自定义页面自制帝国网站地图,含xml、txt、html三种格式,默认调用首页、栏目页及文章页链接
注意:xml中<mobile:mobile type="pc,mobile"/>是百度移动sitemap协议,非自适应请修改,pc删除,移动:type="mobile"
默认-sitemapXML:
- <?='<?xml version="1.0" encoding="UTF-8"?>'?>
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:mobile="http://www.baidu.com/schemas/sitemap-mobile/1/">
- <url>
- <loc>[!--news.url--]</loc>
- <mobile:mobile type="pc,mobile"/>
- <lastmod><?php echo date("Y-m-d H:i:s") ; ?></lastmod>
- <changefreq>Always</changefreq>
- <priority>1.00</priority>
- </url>
- [e:loop={"select * from [!db.pre!]enewsclass order by myorder",0,24,0}]
- <?if($bqr['classurl']==''){$sccurl=$public_r['newsurl'].$bqr['classpath']."/";}else{$sccurl=$bqr['classurl']."/";}?>
- <url>
- <loc><?=$sccurl?></loc>
- <mobile:mobile type="pc,mobile"/>
- <lastmod><?php echo date("Y-m-d H:i:s") ; ?></lastmod>
- <changefreq>Always</changefreq>
- <priority>0.80</priority>
- </url>
- [/e:loop]
- [e:loop={"select * from [!db.pre!]enewstags order by num DESC",0,24,0}]
- <url>
- <loc>[!--news.url--]<?echo 'tags/'.urlencode($bqr['tagname']).'/';?></loc>
- <mobile:mobile type="pc,mobile"/>
- <lastmod><?php echo date("Y-m-d H:i:s") ; ?></lastmod>
- <changefreq>Always</changefreq>
- <priority>0.60</priority>
- </url>
- [/e:loop]
- [e:loop={"select * from [!db.pre!]ecms_news order by newstime desc",0,24,0}]
- <url>
- <loc><?=$bqsr[titleurl]?></loc>
- <mobile:mobile type="pc,mobile"/>
- <lastmod><?=date('Y-m-d H:i:s',$bqr[newstime])?></lastmod>
- <changefreq>Always</changefreq>
- <priority>0.60</priority>
- </url>
- [/e:loop]
- </urlset>
复制代码
默认-sitemapTXT:
- [!--news.url--]
- [e:loop={"select * from [!db.pre!]enewsclass order by myorder",0,24,0}]
- <?if($bqr['classurl']==''){$sccurl=$public_r['newsurl'].$bqr['classpath']."/";}else{$sccurl=$bqr['classurl']."/";}?>
- <?=$sccurl?>
- [/e:loop]
- [e:loop={"select * from [!db.pre!]enewstags order by num DESC",0,24,0}]
- [!--news.url--]<?echo 'tags/'.urlencode($bqr['tagname']).'/';?>
- [/e:loop]
- [e:loop={"select * from [!db.pre!]ecms_news order by newstime desc",0,24,0}]
- <?=$bqsr[titleurl]?>
- [/e:loop]
复制代码
默认-sitemapHTML:
注意栏目标题调用的是别名,栏目名称用<?=$bqr['classname']?>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>站点地图 - <?=$public_r['sitename']?></title>
- </head>
- <body>
- <a href="[!--news.url--]" title="<?=$public_r['sitename']?>"><?=$public_r['sitename']?></a><br>
- [e:loop={"select * from [!db.pre!]enewsclass order by myorder",0,24,0}]
- <?if($bqr['classurl']==''){$sccurl=$public_r['newsurl'].$bqr['classpath']."/";}else{$sccurl=$bqr['classurl']."/";}?>
- <a href="<?=$sccurl?>" title="<?=$bqr['bname']?>"><?=$bqr['bname']?></a><br>
- [/e:loop]
- [e:loop={"select * from [!db.pre!]enewstags order by num DESC",0,24,0}]
- <a href="[!--news.url--]<?echo 'tags/'.urlencode($bqr['tagname']).'/';?>" title="<?=$bqr[tagtitle]?>"><?=$bqr[tagtitle]?></a><br>
- [/e:loop]
- [e:loop={"select * from [!db.pre!]ecms_news order by newstime desc",0,24,0}]
- <a href="<?=$bqsr[titleurl]?>" title="<?=$bqr[title]?>"><?=$bqr[title]?></a><br>
- [/e:loop]
- </body>
- </html>
复制代码
自定页页面链接调用:
提示:where id!=1 and id!=2 and id!=3可排除不需要调用的自定义页面
XML(粘贴至默认map的</urlset>上面):
- [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}]
- <?php $pageurl=$public_r['newsurl'].str_replace('../../','',$bqr['path']);?>
- <url>
- <loc><?=$pageurl?></loc>
- <mobile:mobile type="pc,mobile"/>
- <lastmod><?php echo date("Y-m-d H:i:s") ; ?></lastmod>
- <changefreq>Always</changefreq>
- <priority>0.60</priority>
- </url>
- [/e:loop]
复制代码
TXT(粘贴至默认map的尾部):
- [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}]
- <?php $pageurl=$public_r['newsurl'].str_replace('../../','',$bqr['path']);?>
- <?=$pageurl?>
- [/e:loop]
复制代码
HTML(粘贴至默认map的</body>上面):
- [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}]
- <?php $pageurl=$public_r['newsurl'].str_replace('../../','',$bqr['path']);?>
- <a href="<?=$pageurl?> " title="<?=$bqr[title]?>"><?=$bqr[title]?></a><br/>
- [/e:loop]
复制代码
专题链接调用:
xml(粘贴至默认map的</urlset>上面):
- [e:loop={"select * from [!db.pre!]enewszt order by ztid",0,24,0}]
- <?if($bqr['zturl']==''){$sccurl=$public_r['newsurl'].$bqr['ztpath']."/";}else{$sccurl=$bqr['zturl']."/";}?>
- <url>
- <loc><?=$sccurl?></loc>
- <lastmod><?php echo date("Y-m-d H:i:s") ; ?></lastmod>
- <changefreq>daily</changefreq>
- <priority>0.6000</priority>
- </url>
- [/e:loop]
复制代码
txt(粘贴至默认map的尾部):
- [e:loop={"select * from [!db.pre!]enewszt order by ztid",0,24,0}]
- <?if($bqr['zturl']==''){$sccurl=$public_r['newsurl'].$bqr['ztpath']."/";}else{$sccurl=$bqr['zturl']."/";}?>
- <?=$sccurl?>
- [/e:loop]
复制代码
html(粘贴至默认map的</body>上面):
- [e:loop={"select * from [!db.pre!]enewszt order by ztid",0,24,0}]
- <?if($bqr['zturl']==''){$sccurl=$public_r['newsurl'].$bqr['ztpath']."/";}else{$sccurl=$bqr['zturl']."/";}?>
- <a href="<?=$sccurl?>" title="<?=$bqr[classname]?>"><?=$bqr[classname]?></a><br>
- [/e:loop]
复制代码
|
|