WWW::Google::SiteMap::Index入れて
#!/usr/local/bin/perl
use strict;
use WWW::Google::SiteMap::Index;
# path to sitemap from HomeDir
my @sitemaps = qw(
public_html/diary/sitemap.xml.gz
public_html/bsd/index.xml
);
my $home = home_dir();
my $index = WWW::Google::SiteMap::Index->new(
file => "$home/public_html/sitemap-index.gz",
);
for my $f (@sitemaps) {
$index->add(
loc => "http://$f",
# lastmod => (lstat("$home/$f"))[9],
);
}
$index->write();
sub home_dir {
eval { require File::HomeDir };
return $@ ? $ENV{HOME} : File::HomeDir->my_home;
}
というのを実行してつくったら
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/siteindex.xsd">
<sitemap>
<loc>http://www.otsune.com/diary/sitemap.xml.gz</loc>
</sitemap>
<sitemap><loc>http://www.otsune.com/bsd/index.xml</loc></sitemap>
</sitemapindex>
という感じで。
このブログにコメントするにはログインが必要です。
さんログアウト
この記事には許可ユーザしかコメントができません。