FarmSideBar
Question
I have a wiki site with several fields where I'd like a common appearance of the sidebar. How can I arrange this? In addition, I'd also like the common part of the sidebar to automatically indicate which field the reader is currently browsing.
Answer
Here is one solution that assumes you keep the group Site/
common to all
fields. This group will for instance contain the primary sidebar page. The
primary sidebar will then "recursively" include pages as follows:
Site.SideBar `-- Field.SideBar-field `-- {$Group.SideBar-group}
where Field.SideBar-field
contains the part of the sidebar that is
specific to the current field. Let's assume we have a simple site with two
fields called A and B. Field A contains the groups GroupA, GroupB
and GroupC, while Field B contains the groups GroupD, GroupE,
GroupF. The relevant pages would then be as follows:
Site.SideBar - global sidebar, common to all fields A:Field.SideBar-field - part of sidebar specific to field A B:Field.SideBar-field - part of sidebar specific to field B A:GroupA.SideBar-group - part of sidebar specific to A:GroupA/ A:GroupB.SideBar-group - part of sidebar specific to A:GroupB/ A:GroupC.SideBar-group - part of sidebar specific to A:GroupC/ B:GroupD.SideBar-group - part of sidebar specific to B:GroupD/ B:GroupE.SideBar-group - part of sidebar specific to B:GroupE/ B:GroupF.SideBar-group - part of sidebar specific to B:GroupF/
In order to let the sidebar automatically indicate which field the reader is visiting, we can for instance let Site.SideBar contain something like this:
! Fields * %field-A%[[Field A -> A:Main/HomePage]]%% * %field-B%[[Field B -> B:Main/HomePage]]%% (:include Field.SideBar-field:)
where we have assumed that the prefixes A:
and B:
have been defined
to point to the respective field. In addition, it is the job of the page
Field.SideBar-field to define the wikistyle for this field. So in case of
the page A:Field.SideBar-field, it should contain something like this:
%define=field-A color=red% ! Groups * %group-A%[[GroupA/Group A]]%% * %group-B%[[GroupB/Group B]]%% * %group-C%[[GroupC/Group C]]%% (:include {$Group}.SideBar-group:)
where along similar lines, a page such as GroupA.SideBar-group should contain something like:
%define=field-A color=green%
Notes
The principle above should work with other naming schemes for the pages. If
you don't want the group specific part of the sidebar cluttering the
different groups, you could place those pages in the group Field/
. We
could have these pages then:
Site.SideBar - common sidebar template A:Field.SideBar-field - part specific to field A A:Field.SideBar-group-GroupA - part specific for group A A:Field.SideBar-group-GroupB - part specific for group B A:Field.SideBar-group-GroupC - part specific for group C B:Field.SideBar-field - part specific to field B B:Field.SideBar-group-GroupD - part specific for group D B:Field.SideBar-group-GroupE - part specific for group E B:Field.SideBar-group-GroupF - part specific for group F
where you should probably remember to qualify links in the group specific
pages, e.g. Field.SideBar-group-GroupA
, with the name of the group when
referring to pages in the current group.
An even more centralized approach puts all the pages related to the sidebar
in the shared group Site/
. In this case you should propably also qualify
the links with intermap prefixes.
See Also
Contributors
- Christian Ridderström chr
Comments
See discussion at FarmSideBar-Talk