diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-02-05 21:54:36 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-02-05 21:54:36 +0000 |
commit | 46f0f5bdc23139f0a382e608904c2acc8a774e73 (patch) | |
tree | b489f518a3c29bc79b4adb7f4d923d6e01b2dd41 /IkiWiki/Plugin | |
parent | 4133ec4fabf085a31c167093bf296d0b860f86d9 (diff) |
* Add feedshow option to allow reducing the number of items included in
an rss or atom feed.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index ec1cf0970..06b74b3fa 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -190,19 +190,25 @@ sub preprocess_inline (@) { #{{{ } } - if ($feeds && $rss) { - will_render($params{page}, rsspage($params{page})); - writefile(rsspage($params{page}), $config{destdir}, - genfeed("rss", $rssurl, $desc, $params{page}, @list)); - $toping{$params{page}}=1 unless $config{rebuild}; - $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/rss+xml" title="RSS" href="$rssurl" />}; - } - if ($feeds && $atom) { - will_render($params{page}, atompage($params{page})); - writefile(atompage($params{page}), $config{destdir}, - genfeed("atom", $atomurl, $desc, $params{page}, @list)); - $toping{$params{page}}=1 unless $config{rebuild}; - $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/atom+xml" title="Atom" href="$atomurl" />}; + if ($feeds) { + if (exists $params{feedshow} && @list > $params{feedshow}) { + @list=@list[0..$params{feedshow} - 1]; + } + + if ($rss) { + will_render($params{page}, rsspage($params{page})); + writefile(rsspage($params{page}), $config{destdir}, + genfeed("rss", $rssurl, $desc, $params{page}, @list)); + $toping{$params{page}}=1 unless $config{rebuild}; + $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/rss+xml" title="RSS" href="$rssurl" />}; + } + if ($atom) { + will_render($params{page}, atompage($params{page})); + writefile(atompage($params{page}), $config{destdir}, + genfeed("atom", $atomurl, $desc, $params{page}, @list)); + $toping{$params{page}}=1 unless $config{rebuild}; + $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/atom+xml" title="Atom" href="$atomurl" />}; + } } return $ret; |