inline: Support emptyfeeds=no option to skip generating empty feeds.

master
Joey Hess 2008-12-11 14:04:38 -05:00
parent 38f5e3ba69
commit 63eb9d834e
4 changed files with 15 additions and 3 deletions

View File

@ -161,6 +161,7 @@ sub preprocess_inline (@) { #{{{
my $atom=(($config{atom} || $config{allowatom}) && exists $params{atom}) ? yesno($params{atom}) : $config{atom};
my $quick=exists $params{quick} ? yesno($params{quick}) : 0;
my $feeds=exists $params{feeds} ? yesno($params{feeds}) : !$quick;
my $emptyfeeds=exists $params{emptyfeeds} ? yesno($params{emptyfeeds}) : 1;
my $feedonly=yesno($params{feedonly});
if (! exists $params{show} && ! $archive) {
$params{show}=10;
@ -289,8 +290,13 @@ sub preprocess_inline (@) { #{{{
gettext("Add a new post titled:"));
}
$ret.=$formtemplate->output;
# The post form includes the feed buttons, so
# emptyfeeds cannot be hidden.
$emptyfeeds=1;
}
elsif ($feeds && !$params{preview}) {
elsif ($feeds && !$params{preview} &&
! (! $emptyfeeds && ! @feedlist)) {
# Add feed buttons.
my $linktemplate=template("feedlink.tmpl", blind_cache => 1);
$linktemplate->param(rssurl => $rssurl) if $rss;
@ -367,7 +373,7 @@ sub preprocess_inline (@) { #{{{
}
}
if ($feeds) {
if ($feeds && ! (! $emptyfeeds && ! @feedlist)) {
if ($rss) {
my $rssp=rsspage($params{destpage}).$feednum;
will_render($params{destpage}, $rssp);

1
debian/changelog vendored
View File

@ -10,6 +10,7 @@ ikiwiki (2.71) UNRELEASED; urgency=low
* Fix handling of wrappergroup option.
* Correct --dumpsetup to include the srcdir in the setup file.
* German translation update from Kai Wasserbäch. Closes: #507056
* inline: Support emptyfeeds=no option to skip generating empty feeds.
-- Joey Hess <joeyh@debian.org> Mon, 17 Nov 2008 14:02:10 -0500

View File

@ -73,6 +73,8 @@ Here are some less often needed parameters:
configured to `allowatom`, set to "yes" to enable.
* `feeds` - controls generation of all types of feeds. Set to "no" to
disable generating any feeds.
* `emptyfeeds` - Set to "no" to disable generation of empty feeds.
Has no effect if `rootpage` or `postform` is set.
* `template` - Specifies the template to fill out to display each inlined
page. By default the `inlinepage` template is used, while
the `archivepage` template is used for archives. Set this parameter to
@ -97,7 +99,7 @@ Here are some less often needed parameters:
in the blog. The format string is passed to the strftime(3) function.
* `feedpages` - A [[PageSpec]] of inlined pages to include in the rss/atom
feeds. The default is the same as the `pages` value above, and only pages
matches by that value are included, but some of those can be excluded by
matched by that value are included, but some of those can be excluded by
specifying a tighter [[PageSpec]] here.
* `guid` - If a URI is given here (perhaps a UUID prefixed with `urn:uuid:`),
the Atom feed will have this as its `<id>`. The default is to use the URL

View File

@ -2,3 +2,6 @@
drop the rss/atom buttons for comments when there are none yet
This seems to me like something that applies to the [[plugins/inline]] plugin in general, rather than the [[plugins/contrib/comments]] plugin specifically. --[[smcv]]
>> [[done]] as emptyfeeds option, not on by default for inline, but I think
>> it should be for comments --[[Joey]]