[All Adaptavist Apps]
Using decorators to display or hide content is a powerful way to flexible layouts that adapt to according to the type of page being viewed.
A decorator is template that is applied to content. Confluence passes a decorator to Theme Builder. You can use this decorator to display content using the {builder-show
} or {{builder-hide
} macros.
Spaces use three different decorators, space, page and blogpost. You can combine multiple decorators in one {builder-show
} statement like this:
{builder-show:decorator=space,page,blogpost} using the space decorator {builder-show}
Pages that use the global decorator include, Dashboard, RSS Feed Builder and People Directory. The Popular Labels page, however uses its own decorator, labels. Search Site also uses it own, search.
So to apply content to Dashboard, RSS Feed Builder, People Directory, Popular Labels and Search Site. We would do the following:
{builder-show:decorator=global,labels,search} using the global decorator {builder-show}
Some pages that you may think would have global their decorator in fact have a null value instead namely Login, Sign Up For Confluence and Create Space.
Pages associated with user profiles such as User Profile, Edit My Profile, Personal Labels, Watches and Drafts use the profile decorator. Its worth noting however that a personal space will use the same decorators as a normal space.
You can use {use-layout
} macro with an builder-show macro to switch layouts based on decorator.
{builder-show:decorator=printable}{use-layout:LAYOUTID}{builder-show}
These are some of the current decorators.
Decorator |
---|
main |
page |
space |
blogpost |
printable |
footer |
global |
labels |
profile |
search |
This may not be a complete list
Page Title |
Action Name |
Decorator |
Context |
Mode |
---|---|---|---|---|
Login |
login |
null |
null |
null |
Sign Up For Confluence |
signup |
null |
null |
null |
Dashboard |
dashboard |
global |
global |
dashboard |
RSS Feed Builder |
configurerssfeed |
global |
global |
rss |
People Directory |
browsepeople |
global |
global |
userdir |
Popular Labels |
listlabels-heatmap |
labels |
labels |
view-labels-popular |
User Profile |
viewuserprofile |
profile |
profile |
view-profile |
Edit My Profile |
editmyprofile |
profile |
profile |
edit-profile |
Personal Labels |
viewmylabels |
profile |
profile |
my-labels |
Watches |
viewnotifications |
profile |
profile |
edit-notifications-profile |
Drafts |
viewmydrafts |
profile |
profile |
drafts |
Create Space |
createspace-start |
null |
null |
null |
View News Posts In A Space |
space |
space-blogposts |
view-blogposts |
|
Adding A News Post |
createblogpost |
space |
space-blogposts |
create-blogpost |
Viewing A News Post |
viewpage |
blogpost |
blogpost |
view |
Editing A News Post |
editblogpost |
blogpost |
blogpost |
edit |
Viewing A News Post's Attachments |
viewpageattachments |
blogpost |
blogpost |
view-attachments |
Copying A Page |
copypage |
space |
space-pages |
create-page |
Adding A Page |
createpage |
space |
space-pages |
create-page |
Viewing A Page |
viewpage |
page |
page |
view |
Editing A Page |
editpage |
page |
page |
edit |
Viewing Page Attachments |
viewpageattachments |
page |
page |
view-attachments |
Viewing Page Information |
viewinfo |
page |
page |
view-information |
List Pages - Tree View |
listpages-dirview |
space |
space-pages |
list-content-tree |
Site Search |
dosearchsite |
search |
search |
null |
6 Comments
Unknown User (ville.valtasaari@thl.fi)
How do I apply this to put a sidebar in this context:
View News Posts In A Space
space
space-blogposts
view-blogposts
There is no mode and I can't seem to make it work based on the decorator.
r. Ville
Unknown User (amoran)
Append ?layout=default to the URL and look at the debug comment at the top of the html ... this will tell you exactly what the mode, decorator and context are for the page you are viewing.
Unknown User (ville.valtasaari@thl.fi)
Cheers,
That helped.
r. Ville
Unknown User (vladimir@sirma.bg)
Can I use these macros to omit some content from PDF export? I tried this but it doesn't work:
Note: the space uses Documentation Theme, not a builder theme
Unknown User (amoran)
the context, mode and decorator switches are only available in the builder theme.
Also the PDF generation process will not provide the decorator flag, nor will the theme be executed anyway ... I believe that the scroll exporter may have a solution for this.
Unknown User (vladimir@sirma.bg)
Turns out that's in the user guide: http://confluence.atlassian.com/display/DOC/NoPrint+Example+of+a+User+Macro http://confluence.atlassian.com/display/DOC/Advanced+PDF+Stylesheet+Customisations#AdvancedPDFStylesheetCustomisations-noprint
It has limitations (processes the body, always makes block not inline) but works for me