...
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 hides the context and mode for each page.
Expand |
---|
| View example... |
---|
| View example... |
---|
|
If you view the HTML source of this web page you'll see the following: No Format |
---|
<!-- main.vmd
themebuilder : 'com.adaptavist.confluence.sitebuilder.SiteBuilderVelocityHelper@524c9770'/'$themebuilder.initialise'
spaceKey : 'USERGUIDE'
pageId : '10578'
currentURL : '/pages/viewpage.action?spaceKey=USERGUIDE&title=builder-hide+macro'
contextPath : ''
spaceName : 'User Guides'
decorator : '$decorator'
printable : 'false'
mailId : '$mailId'
mode : 'view'
context : 'page'
-->
|
|
You can specify multiple contexts and modes by separating them with commas as hiden in the usage example earlier. For the macro content to hide, all contexts and modes specified must match.
Some common contexts and modes are listed below, along with the associated menulink macro settings to create links to them.
Modes for context: page
All of these modes have a context of page and apply when working with content pages (including the Space home page):
Mode | Notes | Menulink |
---|
view | Normal view of a page, including when adding comments to a page | normalView
|
---|
edit | Edit view of an existing page (see space-pages context for details of adding or copying pages). | edit
|
---|
view-attachments | Viewing attachments on a page. | pageattachments
|
---|
view-information | Displaying page information. | information
|
---|
Modes for context: space-blogposts
This mode relates to the view of recent blogposts in a space:
Mode | Notes | Menulink |
---|
view-blogposts | List of recent blogposts in a space. | news
|
---|
Modes for context: space-labels
All of these modes have a context of space-labels and relate to the label views within spaces.
Mode | Notes | Menulink |
---|
view-labels-popular | View popular labels | labels
|
---|
view-labels-all | View all labels | |
---|
Modes for context: space-attachments
This mode applies to the index of attachments within a space:
Mode | Notes | Menulink |
---|
view-attachments | Index of space attachments. | spaceattchments
|
---|
Modes for context: space-administration
All space administration pages have a single mode as far as we can tell:
Mode | Notes | Menulink |
---|
view-space-administration | Any page within space admin area, regardless of whether you are viewing or editing, etc. | spaceadmin and configuretheme
|
---|
Modes for context: space-pages
All of these modes have a context of space-pages and apply to standard space features such as the alphabetical index and site map.
Mode | Notes | Menulink |
---|
create-page | Applies when creating a new page or copying an existing page. | newpage and copy
|
---|
list-recently-updated | List of recently updated pages. | recent
|
---|
list-alphabetically | Alphabetical page index. | index
|
---|
list-content-tree | Site map (i.e. pages tree view). | map
|
---|
Modes for context: global
These modes relate to global (outside a space) locations:
Mode | Notes | Menulink |
---|
rss | RSS Feed Builder | RSS
|
---|
more to follow ![(smile)](/s/-sh5fb0/8804/os61ar/_/images/icons/emoticons/smile.svg)
Examples
Examples
Expand |
---|
| Hide content on news items |
---|
| Hide content on news items |
---|
|
To hide some content only on news items (blogposts), you must use the macro within a panel in the Builder theme: Code Block |
---|
{builder-hide:context=news}
This text will not be shown on news items
{builder-hide}
|
|
Expand |
---|
| Hide content on pages and news items |
---|
| Hide content on pages and news items |
---|
|
To hide something in multiple contexts, simply separate them with commas: Code Block |
---|
{builder-hide:context=page,blogpost}
something to hide on pages and news items
{builder-hide}
|
|
Expand |
---|
| Hide content in edit mode |
---|
| Hide content in edit mode |
---|
|
When you change the view of something, eg. look at the normal view or editable view, the "mode" changes and you can take advantage of this to customise your theme depending on which mode is currently active. For example, if you only want to hide something when it's being edited (eg. editing a page or news item), use the following: Code Block |
---|
{builder-hide:mode=edit}
something to hide
{builder-hide}
|
You can hide something in multiple modes by separating them with commas: Code Block |
---|
{builder-hide:mode=edit,view}
something to hide
{builder-hide}
|
|
Expand |
---|
| Specific modes within specific contexts |
---|
| Specific modes within specific contexts |
---|
|
If you only want to hide something in view mode within the context of a page, use the following: Code Block |
---|
{builder-hide:mode=view|context=page}
something to hide
{builder-hide}
|
When more than one parameter of the macro is specified, both parameters must match so in the example above the user must be looking at a page context in view mode. You can specify multiple modes and contexts, for example: Code Block |
---|
{builder-hide:mode=view,edit|context=page,blogpost}
something to hide
{builder-hide}
|
In the example above, the content would be hiden if the user is looking at either a "page" or a "blogpost" (news item) that must also be in either the "view" or "edit" mode.
|
Expand |
---|
| Hide content based on labels |
---|
| Hide content based on labels |
---|
|
You can hide content if the current location has one or more of the specified labels: Code Block |
---|
{builder-hide:labels=my:favourite,meetings}
don't show this on content labelled as the users' favourite or meetings
{builder-hide}
|
Beware! Most people assume that only pages and news articles can have labels, but this is not the case. When viewing space-level pages that aren't normal content pages or news articles, for example when viewing the space labels or even space admin, this macro uses any defined space labels.
|
Expand |
---|
| Hiding content if a space exists |
---|
| Hiding content if a space exists |
---|
|
You can hide content if a space exists by specifying it's space key as follows: Code Block |
---|
{builder-hide:space=ACCOUNTS}
The space with key "ACCOUNTS" does not exist!
{builder-hide}
|
As you can see, this is ideal for customising content based on which spaces a user has privilegs to access. If the user doesn't have access to a space, it's as if the space doesn't exist.
|
Expand |
---|
| Hide content based on existence of a page |
---|
| Hide content based on existence of a page |
---|
|
You can hide content if a specific page (within the current space) exists: Code Block |
---|
{builder-hide:page=My Page}
The page "My Page" does not exist!
{builder-hide}
|
This is really useful because you can show warnings or links, etc., if pages don't exist. For example, you might want a legal disclaimer in a space and you could warn users if it doesn't exist.
|
Expand |
---|
| Hide content if the page has a parent |
---|
| Hide content if the page has a parent |
---|
|
You can hide content if the current page has a parent page using the following notation: Code Block |
---|
{builder-hide:page=@parent}
This page does not have a parent page!
{builder-show}
|
This is useful because you often want to include specific navigation on pages that do not have a parent page, for example you might want to include the pagetree macro on your home page to ease navigation. Pages which don't have a parent are: - The space homepage
- Orphan pages (pages within a space that don't have a parent)
|
Expand |
---|
| Hide content for specific page titles |
---|
| Hide content for specific page titles |
---|
|
You can hide content if the current page has a specific title, for example: Code Block |
---|
{builder-hide:title=My Homepage}
This is not my home page!
{builder-hide}
|
This can come in handy if you are using templates to generate content and want to hide something based on the page title. Alternatively, you might want a specific page title to be used whenever a certain template is used, for example: Code Block |
---|
{builder-hide:title=Meeting}
(!) Please rename this page to "Meeting" to aid consistency throughout this site.
{builder-hide}
|
Another use is to add labels to pages based on their title: Code Block |
---|
{builder-hide:title=Home}{add-label:not-home-page}{builder-hide}
|
Simply add that to the Header panel in theme config and any page that is not called "Home" will get a label of "not-home-page" added to it thanks to the add-label macro. This is useful because it allows you to search all pages that aren't a home page within the site!
|
Expand |
---|
| Hiding content based on metadata |
---|
| Hiding content based on metadata |
---|
|
Alain to fill this bit in as I have no idea how it works! Also note the hierarchical nature of the checking on this.
|
CSS Customisation
Not applicable for this macro.
...