This way, the example blog always has a sidebar on the index page,
but not the overhead of sidebars on all the other pages. And if a
user wants to, they can enable global_sidebars to switch to sidebars on
every page.
global_sidebars => {
type => "boolean",
examples => 1,
global_sidebars => {
type => "boolean",
examples => 1,
- description => "show sidebar page on all pages?"
+ description => "show sidebar page on all pages?",
safe => 1,
rebuild => 1,
},
safe => 1,
rebuild => 1,
},
my $content=shift;
shift;
my $content=shift;
shift;
- if (! defined $content) {
- error(gettext("sidebar content not specified"));
- }
-
my $page=$params{page};
return "" unless $page eq $params{destpage};
my $page=$params{page};
return "" unless $page eq $params{destpage};
- my $file = $pagesources{$page};
- my $type = pagetype($file);
-
- $pagesidebar{$page}=
- IkiWiki::htmlize($page, $page, $type,
- IkiWiki::linkify($page, $page,
- IkiWiki::preprocess($page, $page,
- IkiWiki::filter($page, $page, $content))));
+
+ if (! defined $content) {
+ $pagesidebar{$page}=undef;
+ }
+ else {
+ my $file = $pagesources{$page};
+ my $type = pagetype($file);
+
+ $pagesidebar{$page}=
+ IkiWiki::htmlize($page, $page, $type,
+ IkiWiki::linkify($page, $page,
+ IkiWiki::preprocess($page, $page,
+ IkiWiki::filter($page, $page, $content))));
+ }
sub sidebar_content ($) {
my $page=shift;
sub sidebar_content ($) {
my $page=shift;
- return $pagesidebar{$page} if exists $pagesidebar{$page};
+ return $pagesidebar{$page} if defined $pagesidebar{$page};
- return if defined $config{global_sidebars} && !$config{global_sidebars};
+ return if ! exists $pagesidebar{$page} &&
+ defined $config{global_sidebars} && ! $config{global_sidebars};
my $sidebar_page=bestlink($page, "sidebar") || return;
my $sidebar_file=$pagesources{$sidebar_page} || return;
my $sidebar_page=bestlink($page, "sidebar") || return;
my $sidebar_file=$pagesources{$sidebar_page} || return;
[[!inline pages="./posts/* and !*/Discussion" show="10"
actions=yes rootpage="posts"]]
[[!inline pages="./posts/* and !*/Discussion" show="10"
actions=yes rootpage="posts"]]
-[[!sidebar """
-[[Tags]]: [[!pagestats style="list" pages="./tags/*" among="./posts/*"]]
-
-[[Recent Comments|comments]]
-
-[[Archives]]
-
-[[!calendar pages="./posts/* and !*/Discussion"]]
-"""]]
This blog is powered by [ikiwiki](http://ikiwiki.info).
This blog is powered by [ikiwiki](http://ikiwiki.info).
--- /dev/null
+[[Tags]]: [[!pagestats style="list" pages="./tags/*" among="./posts/*"]]
+
+[[Recent Comments|comments]]
+
+[[Archives]]
+
+[[!if "enabled(calendar)" then="""
+[[!calendar pages="./posts/* and !*/Discussion"]]
+"""]]
The `sidebar` directive is supplied by the [[!iki plugins/sidebar desc=sidebar]] plugin.
The `sidebar` directive is supplied by the [[!iki plugins/sidebar desc=sidebar]] plugin.
-This directive specifies a custom sidebar to display on the page,
+This directive can specify a custom sidebar to display on the page,
overriding any sidebar that is displayed globally.
overriding any sidebar that is displayed globally.
+If no custom sidebar content is specified, it forces the sidebar page to
+be used as the sidebar, even if the `global_sidebars` setting has been
+used to disable use of the sidebar page by default.
+
## examples
\[[!sidebar """
## examples
\[[!sidebar """
\[[!calendar pages="posts/*"]]
"""]]
\[[!calendar pages="posts/*"]]
"""]]
[[!meta robots="noindex, follow"]]
[[!meta robots="noindex, follow"]]