From 1f7175e891f87c350decc1ec821bebb5adc22c2a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Apr 2010 17:31:50 -0400 Subject: [PATCH] sidebar: Add global_sidebars setting. --- IkiWiki/Plugin/sidebar.pm | 9 +++++++++ debian/changelog | 1 + doc/ikiwiki/directive/sidebar.mdwn | 4 ++-- doc/plugins/sidebar.mdwn | 8 +++++--- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/IkiWiki/Plugin/sidebar.pm b/IkiWiki/Plugin/sidebar.pm index d63cb5246..1b302dcf9 100644 --- a/IkiWiki/Plugin/sidebar.pm +++ b/IkiWiki/Plugin/sidebar.pm @@ -20,6 +20,13 @@ sub getsetup () { safe => 1, rebuild => 1, }, + global_sidebars => { + type => "boolean", + examples => 1, + description => "show sidebar page on all pages?" + safe => 1, + rebuild => 1, + }, } my %pagesidebar; @@ -55,6 +62,8 @@ sub sidebar_content ($) { return $pagesidebar{$page} if exists $pagesidebar{$page}; + return if defined $config{global_sidebars} && !$config{global_sidebars}; + my $sidebar_page=bestlink($page, "sidebar") || return; my $sidebar_file=$pagesources{$sidebar_page} || return; my $sidebar_type=pagetype($sidebar_file); diff --git a/debian/changelog b/debian/changelog index af19f4a00..c379253d7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -40,6 +40,7 @@ ikiwiki (3.20100415) UNRELEASED; urgency=low * sidebar: Now a sidebar directive can be used to override the sidebar shown on a page. * Enable calendar and sidebar in auto-blog.setup. + * sidebar: Add global_sidebars setting. -- Joey Hess Sun, 04 Apr 2010 12:17:11 -0400 diff --git a/doc/ikiwiki/directive/sidebar.mdwn b/doc/ikiwiki/directive/sidebar.mdwn index 46f016747..34f078672 100644 --- a/doc/ikiwiki/directive/sidebar.mdwn +++ b/doc/ikiwiki/directive/sidebar.mdwn @@ -1,7 +1,7 @@ The `sidebar` directive is supplied by the [[!iki plugins/sidebar desc=sidebar]] plugin. -This directive specifies a custom sidebar to display on the page, instead -of any sidebar that is displayed globally. +This directive specifies a custom sidebar to display on the page, +overriding any sidebar that is displayed globally. ## examples diff --git a/doc/plugins/sidebar.mdwn b/doc/plugins/sidebar.mdwn index cd0f0ecf1..012733456 100644 --- a/doc/plugins/sidebar.mdwn +++ b/doc/plugins/sidebar.mdwn @@ -1,9 +1,11 @@ [[!template id=plugin name=sidebar author="Tuomo Valkonen"]] [[!tag type/chrome]] -If this plugin is enabled, then a sidebar is added to pages in the wiki. -The content of the sidebar is simply the content of a page named -"sidebar" (ie, create a "sidebar.mdwn"). +This plugin allows adding a sidebar to pages in the wiki. + +By default, and unless the `global_sidebars` setting is turned off, +a sidebar is added to all pages in the wiki. The content of the sidebar +is simply the content of a page named "sidebar" (ie, create a "sidebar.mdwn"). Typically this will be a page in the root of the wiki, but it can also be a [[ikiwiki/SubPage]]. In fact, this page, -- 2.44.0