[All Adaptavist Apps]

Page tree

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.

What is a decorator?

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.

How to show content in spaces.

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}

How to show content at global level.

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.

Switching layout based on decorator.

You can use {use-layout} macro with an builder-show macro to switch layouts based on decorator.

Example switching to a different layout based on decorator.

{builder-show:decorator=printable}{use-layout:LAYOUTID}{builder-show}

Current decorators.

These are some of the current decorators.

Decorator

main

mail

page

space

blogpost

printable

footer

global

labels

profile

search

Decorators, Contexts and Modes for pages in Confluence.

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

  • No labels

6 Comments

  1. 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

    1. 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.

      1. Unknown User (ville.valtasaari@thl.fi)

        Cheers,

        That helped.

        r. Ville

  2. 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:

    {builder-hide:decorator=printable}
    {recently-updated:max=40}
    {builder-hide}
    

    Note: the space uses Documentation Theme, not a builder theme

    1. 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.

      1. Unknown User (vladimir@sirma.bg)