/コンピュータ/blogn/sitemapに対応させる
やはりGoogleSitemap。
TOPページとカテゴリページ、各記事のページに対応したもの。
URLのみの単純なmapファイルです。
こういうシンプルなXMLであれば、テキストでさくっと作るのが吉。
sitemap.php
<?php
header("Content-type: application/xml; charset=utf-8");
print '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
print '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
require_once("./common.php");
print "<url>\n<loc>".HOMELINK."</loc>\n</url>\n";
$cat= CategoryCount();
if($cat){
foreach($cat as $cid => $ccount){
if($ccount>0 && $cid>0){
print "<url>\n<loc>".HOMELINK."?cid=$cid</loc>\n</url>\n";
}
}
}
$oldid = file(LOGDIR."id.dat");
$oldid[0] = ereg_replace( "\n$", "", $oldid[0] );
$oldid[0] = ereg_replace( "\r$", "", $oldid[0] );
for( $i = $oldid[0] ; $i>0 ; $i-- ){
if(IDCheck($i, 0)){
print "<url>\n<loc>".HOMELINK."?eid=$i</loc>\n</url>\n";
};
}
print '</urlset>';
?>