Plagger::Plugin::Publish::GoogleSitemap.pm
GoogleSitemap では RSS を登録することが可能ですが、ワーニング出るのがうっとおしいので Plagger でまとめて更新できるようにしてみた。
(WWW::Google::SiteMap必須)
2008/1/20追記 CodeReposにコミットしたよ!→http://coderepos.org/share/
package Plagger::Plugin::Publish::GoogleSitemap; use strict; use base qw( Plagger::Plugin ); use Plagger::Date; use File::Spec; use WWW::Google::SiteMap; sub init { my $self = shift; $self->SUPER::init(@_); my $output = $self->conf->{filename} or Plagger->context->error("filename is missing"); } sub register { my($self, $context) = @_; $context->register_hook( $self, 'publish.finalize' => \&finalize, ); } sub finalize { my($self, $context, $args) = @_; unlink( $self->conf->{filename} ); my $map = WWW::Google::SiteMap->new(file => $self->conf->{filename}); for my $feed ($context->subscription->feeds) { for my $entry ($feed->entries) { $map->add(WWW::Google::SiteMap::URL->new( loc => $entry->permalink, lastmod => Plagger::Date->now, )); } } $map->write; } 1; __END__ =head1 Plagger::Plugin::Publish::GoogleSitemap - Publish GoogleSitemap files based on your subscription =head1 SYNOPSIS - module: Publish::GoogleSitemap config: filename: /path/to/subscription.GoogleSitemap =head1 DESCRIPTION This plugin publishes GoogleSitemap file using feeds found in the subscription. =head1 CONFIG =over 4 =item filename Filename to save the GoogleSitemap file. Required. =item title Title to be used as GoogleSitemap head. Optional and defaults to I<Plagger Subscriptions>. =back =head1 AUTHOR UnderDone =head1 SEE ALSO L<Plagger> =cut
lastmod は Feed の時刻にした方がいいかもしれません。
→http://coderepos.org/share/browser/lang/perl/plagger/t/plugins/Publish-GoogleSitemap/GoogleSitemap.pmは対応済み