記事ページ1.0 > トップページ0.8 > 日ページ0.6 > 月ページ0.4sitemapデータを作成して通知。さて、どうなるかな。
perl cli2sitemap.pl cl.itemlist > sitemap.xmlソース (cli2sitemap.pl):
#!/usr/bin/perl
use strict;
my %hash;
while (<>) {
$hash{$1} = $hash{$2} = $hash{$3} = 1
if (/^<a href=\"(((\d+-\d+)-\d+)-\d+)/);
}
my $xml;
foreach (sort keys %hash) {
my $p = (length($_) == 7) ? 0.4 : ((length($_) == 10) ? 0.6 : "1.0");
$xml .= << "URL"
<url>
<loc>http://nais.to/~yto/clog/$_.html</loc>
<changefreq>monthly</changefreq>
<priority>$p</priority>
</url>
URL
}
print << "XML"
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>http://nais.to/~yto/clog/</loc>
<changefreq>dayly</changefreq>
<priority>0.8</priority>
</url>
$xml
</urlset>
XML
;
(「無償・無保証・著作権放棄」<http://lifehacks.ta2o.net/byebye-copyright.html>)