Access Keys:
Skip to content (Access Key - 0)
Home (Access Key - 1)
All spaces... (Access Key - 3)
Log in (Access Key - 5)
Sign up (Access Key - 6)
Toggle Sidebar

builder-show macro

(None)

{builder-show} Macro

Description

The builder-show macro is used to show content in specific contexts, modes and other filters...

Usage

{builder-show:mode=view|context=page|label=meetings|metadata=mykey:myvalue}
stuff to show
{builder-show}

Parameters

Note:
Some parameters, marked "Theme Only", can only be used within Builder theme panels, ie. you cannot use them within pages, etc.

The "Ver" column shows which version of Theme Builder the parameter became available in.

Property Required Default Notes Theme Panels Only Ver
decorator all decorators Only show the content when a specific decorator us being used, eg. "printable", etc.  
action all actions Only show the content for specific action(s), eg. "viewpage". NB: The ".action" part of the action name should not be included.   3.0
context all contexts Only show the content for specific context(s), eg. "page", "global", etc.  
mode all modes Only show the content for specific modes, eg. "view", "edit", etc.  
space n/a Only show the content if a specific space (referred to by the Space Key) exists.    
page n/a Only show the content if a specific page (referred to by the page title) exists.    
title n/a Only show the content if the current page has a specific title    
label n/a Only show the content if the the current location (page, news, etc) has the specified label(s), eg. "my:favourite", "meetings", etc.    
spaceLabels n/a Only show the content if the the current space has the specified label(s), eg. "meetings", etc.   3.0
teamLabels n/a Only show the content if the the current space has the specified team label(s), eg. "sales,marketing", etc.   3.0
metadata n/a Metadata associated with the current location in the format: "myKey1:myValue1", etc.   3.0
user All users A comma separated list of usernames. Use @anonymous for anonymous users only.   3.0
group All groups A comma separated list of user groups. Use @anonymous for anonymous users only.   3.0
permission Any permission A comma separated list of permissions:
  • view - user has view permission
  • comment - user can add comments
  • createpage - user can create pages
  • createnews - user can create news
  • edit - user can edit pages or news
  • remove - user can remove (delete) pages, news or comments
  • attach - user can attach files
  • export - user can export pages or the space
  • createspace - user can create spaces
  • spaceadmin - user is a space admin
  • siteadmin - user is a site admin
  3.0
recurse false Should parent pages (if applicable) be checked for title, labels and metadata?
  • false - only check the current page (default)
  • true - also check parent pages, eg. does the current page or any of it's parents have the specified label, etc.
  3.0

While none of the parameters are mandatory, you must specify at least one of them for this macro to work.

You can specify multiple values for any parameter, for example:

{builder-show:mode=view,edit|context=page,blogpost}
stuff to show
{builder-show}

In the example above, "stuff to show" would only be shown if the content is being shown in "view" or "edit" mode and is also either a "page" or "blogpost".

Contexts, Modes and Decorators

You can determine the context and mode for any page by viewing the page source using your browser. A HTML comment output at the top of all pages shows the context and mode for each page.

View example...

You can specify multiple contexts and modes by separating them with commas as shown in the usage example earlier. For the macro content to show, all contexts and modes specified must match.

Examples

Display content on news items

Display content on pages and news items

Display content in edit mode

Specific modes within specific contexts

Display content based on labels

Displaying content if a space exists

Display content based on existence of a page

Display content if the page has a parent

Display content for specific page titles

Displaying content based on metadata

CSS Customisation

Not applicable for this macro.

Hints and Tips

You can use this macro, and the associated builder-hide macro to customise navigation and panel content depending on what the user is looking at.

When using either the mode, context or decorator parameters, remember that they only work if used within a panel of the Builder theme. If you put them inside a normal page, etc., they won't work. Even if you use the move-to macro to move something from a page in to a panel, it still won't work - the mode, context and decorator settings will only work if the macro is actually in the panel notation in the theme cofiguration settings.

If you need to show or hide content based on the privileges within a space, use the [USERGUIDE:show-if] or [USERGUIDE:hide-if] macros that be found in the Visibility Plugin.

Frequently Asked Questions

None at present.

See Also

Toggle Sidebar

See Also

Incoming Links


Outgoing Links


Added by Alain Moran on Oct 09, 2006 23:29, last edited by Guy Fraser on Jul 21, 2008 19:07

I want to display a vertical, unordered list of labels (as in, not a bulleted or numbered list) in a left navigation panel that is automatically updated as new labels are added. I only want to display the labels that are set at the space level from the Space Administration page in Confluence. (For a visual example, see Gmail.)

How do I accomplish this? Thanks.

Use the [page-info macro].

I want to display content, but only when I am in a page in mode 'attachments'.... how can I do this?

Thanks

Go to the attachments screen and view the HTML source - you should see a HTML comment at the top of the page which states the current context and mode. You can then use the builder-show macro with the desired mode or context to conditionally show content on that screen.

I set the vertical alignment of both my Pagetree2 (on the Left Sidebar), Title and Content items to TOP. However, when I expand my pagetree2 navigation, it forces my content to go down the page, leaving a white space between the Title and Content areas that grows longer the more I collapse my pagetree2 left navigation. How can I fix it?

I am using Theme Builder 3.0 b.19.

thanks,
Doods

Is it possible to only show something to the original page author?



Updated by Guy Fraser
Jul 21, 2008 19:00

Alain recently added some user/group features to the builder-show/hide macros so in theory, yes, but I'll need to check with him when he's back online. I imagine it would need a parameter like user=@author which should hopefully be fairly easy to add in for the final release.

Alternatively, you might be able to use the [show-to macro] (I've not checked if it has a similar meta user) but I'm aware that Cutomware's visibility plugin is a tad broken in recent versions of Confluence.

Hurrah! This got added (user=@author, page author, and user=@owner, space owner).

Is it possible to change the operator to OR instead of using AND?

Take this example, for instance:

{builder-show:mode=view,edit|context=page,blogpost}
stuff to show
{builder-show}

Is there a way to say:

"Show 'stuff to show' if the mode is view or edit OR if the context is a page or a blogpost."

Not that you'd want to do that, but I do want to hide sidebars based on some page titles using that new feature Alain added, and I want to hide them as well based on what .action the user is doing. And it doesn't seem like I can specify all that in the same blurb of code without it hiding them based on all of the conditions...

The difficult part is defining the notation tha creates the rules ... I think it would be likely that we would need to make a fairly large change to the notation so that it is no-longer separate params separated by | signs, but a single param which defines the rules to be used internally, eg:

{builder-show:mode:view,mode:edit,context:page,context:blogpost}...{builder-show}

alternately:

{builder-show:mode:view,mode:edit+context:page,context:blogpost}...{builder-show}

might mean mode=edit/view AND context=page/blogpost

This idea is by no means mature, and any/all input would be useful.

Hi Alain. I like the colon separated pairs, but I'm not sure that the syntax in your second example makes it clear enough that the two sides of the plus are effectively grouped separately, visually the + sign looks like it belongs to just the "context:page" pair.

It seems that the combination
does not work.

user=xx or group=yyy works when not used together.
bug, feature or user error?

How do I show/hide the entire Right Side Bar (and its contents) based on a group? I would like to show it to a group called Editors and hide it from a group called Viewers.

Thanks

This requires 3.0.2, but the following should work

{builder-show:group=mygroup,myothergroup}{builder-sidebar:left|collapse=true}{builder-show}

There is an error at the labels documentation. The example reads

{builder-show:labels=my:favourite,meetings}
This stuff is either in my favourites list or something to do with meetings!
{builder-show}

There is no labels parameter, this should be label!

Thanks for that .. i have updated the content.

When in doubt about parameters be sure to check the notation guide, since this is maintained by the developer rather than the person who writes up the documentation, which means that it is your most authoritative source as to what is available and what isnt.


Adaptavist Theme Builder Powered by Atlassian Confluence