},
global_sidebars => {
type => "boolean",
- examples => 1,
+ example => 1,
description => "show sidebar page on all pages?",
safe => 1,
rebuild => 1,
sub preprocess (@) {
my %params=@_;
- my $content=shift;
- shift;
my $page=$params{page};
return "" unless $page eq $params{destpage};
- if (! defined $content) {
+ if (! defined $params{content}) {
$pagesidebar{$page}=undef;
}
else {
$pagesidebar{$page}=
IkiWiki::htmlize($page, $page, $type,
IkiWiki::linkify($page, $page,
- IkiWiki::preprocess($page, $page,
- IkiWiki::filter($page, $page, $content))));
+ IkiWiki::preprocess($page, $page, $params{content})));
}
return "";
sub sidebar_content ($) {
my $page=shift;
- return $pagesidebar{$page} if defined $pagesidebar{$page};
+ return delete $pagesidebar{$page} if defined $pagesidebar{$page};
return if ! exists $pagesidebar{$page} &&
defined $config{global_sidebars} && ! $config{global_sidebars};
sub pagetemplate (@) {
my %params=@_;
- my $page=$params{page};
my $template=$params{template};
-
- if ($template->query(name => "sidebar")) {
- my $content=sidebar_content($page);
+ if ($params{destpage} eq $params{page} &&
+ $template->query(name => "sidebar")) {
+ my $content=sidebar_content($params{destpage});
if (defined $content && length $content) {
$template->param(sidebar => $content);
}