CustomFeed::Simple を使った場合、フィードのタイトルはページの <title> 要素の中身になる。
こちらで指定したい場合があったので、指定できるようにしてみた。
Index: lib/Plagger/Plugin/CustomFeed/Simple.pm
===================================================================
--- lib/Plagger/Plugin/CustomFeed/Simple.pm (リビジョン 1694)
+++ lib/Plagger/Plugin/CustomFeed/Simple.pm (作業コピー)
@@ -44,7 +44,7 @@
}
my $content = decode_content($res);
- my $title = extract_title($content);
+ my $title = $self->conf->{title} || extract_title($content);
my $feed = Plagger::Feed->new;
$feed->title($title);
config.yaml
- module: CustomFeed::Simple
config:
title: ほげほげ
mizzy さんのコメントをもとに、 Subscription::Config での指定を生かすように修正しました。
Index: lib/Plagger/Plugin/CustomFeed/Simple.pm
===================================================================
--- lib/Plagger/Plugin/CustomFeed/Simple.pm (リビジョン 1694)
+++ lib/Plagger/Plugin/CustomFeed/Simple.pm (作業コピー)
@@ -44,7 +44,7 @@
}
my $content = decode_content($res);
- my $title = extract_title($content);
+ my $title = $args->{feed}->title || extract_title($content);
my $feed = Plagger::Feed->new;
$feed->title($title);
config.yaml
- module: Subscription::Config
config:
feed:
- url: http://....
meta:
follow_link: ....
title: ほげほげ
- module: CustomFeed::Simple
CustomFeed::Simple のタイトル指定ですが、これだと複数のフィードがある場合も、全部同じタイトルになっちゃいますね。<br><br>Subscription::Config でタイトルが指定できるので、そちらで指定しておいて、CustomFeed:::Simple では<br><br>my $title ||= extract_title($content);<br><br>とするのがいいんじゃないかと思います。
ありがとうございます。複数フィードのことは考えから抜けていました。<br>確かにそちらの方がいいですね。