Hide If

Description

This macro will hide its contents to the viewer if the context matches the parameters specified.

On Cloud, if you have large content consider breaking it into smaller chunks over multiple Hide If macros to avoid performance issues.

(warning) Be aware that content is only hidden in the Confluence page view, and that the content is still available when editing a page, viewing page history, email notifications, etc. To truly secure sensitive information, consider using the Security & Encryption app instead.

Macros may not be available in Confluence upon installation

There is a known issue in Confluence Cloud (CONFCLOUD-58280) which prevents new macros from appearing in Confluence. Refer to this knowledge base (KB) article for recommended workarounds.


Parameters

NameRequiredAvailable InMigratable to Cloud?Default ValueDescription

Match Using

 (error)

Server, Data Center, Cloud

Yes

any

If set to all, then all items listed must match.

Users

 (error)

Server, Data Center, Cloud

Yes

 

The the list of user(s) to match, separated by comma. e.g.: "bob,marley" will match both "bob" and "marley".

Special Usernames

 (error)

Server, Data Center

No

 

The user to match, using special usernames:

  • @anonymous - No user is currently logged in
  • @authenticated - Any authenticated user is logged in.
  • @self - The current user.

User Groups

 (error)

Server, Data Center, Cloud

Yes

 

The group(s) to match, separated by comma or semicolon (Server and Data Center only).

e.g.: 'confluence-users' will match all logged in users.

Space Permissions

 (error)

Server, Data Center

No

 

This property allows you to define whether the content inside this macro is hidden to a certain user based on his space permissions. This can be done by either of the following:

  • Using @self to specify current space, followed by ":", then followed by permission type e.g. @self:view
  • Using Space Key then followed by ":" and permission type. e.g. PROJ:admin

These are the permission types:

  • view - (default) The user can view the space.
  • edit - The user can edit pages.
  • admin - The user can administer the space.
  • news - The user can post a blog entry.

Content Types

 (error)

Server, Data Center

No

 

The (list of) page types. May be:

  • page
  • news
  • comment
  • spacedescription

Display Types

 (error)

Server, Data Center

No

 

This property allows the user to hide content only in a document that has been exported to PDF or Word and not on the Confluence page.

The (list of) display modes:

  • default - content is hidden in both Confluence and the exported PDF or Word document
  • printable - content is hidden only in the exported PDF or Word document

Current Space

 (error)

Server, Data Center

No

 

The (list of) spaces this will be displayed in.

Action Types

 (error)

Server, Data Center

No

 

The action taking place.

  • view - The content is editable and is currently being viewed.
  • edit - The content is editable and is currently being edited.
  • template - The content is a template being previewed.
  • dashboard - The content is the dashboard.

Labels

 (error)

Server, Data Center

No

 

The list of labels to test are present or absent.

HTTP Headers

 (error)

Server, Data Center

No

 

The list of header "name:value" pairs to check for. This can either be of the form "name*:exact value" or "name::*regular expression".

For example, to check if the current browser is FireFox, set to 'header=User-Agent::.*Firefox.*'

This will confirm that the 'User-Agent' header contains 'Firefox'.

What headers are available will depend on the browser being used.

Scope

 (error)

Server, Data Center

No

 

(Since 1.6.0) Tests if the current location is in the specified scope.

You can specify a particular page, or set the scope to the children, descendants or ancestors of another page:

  • > children - The direct children of the specified page. e.g.: 'scope=My Page > children'
  • descendants - All descendants of the specified page. e.g.: 'scope="My Page" > descendants'
  • > ancestors - All ancestors of the specified page. E.g. 'scope=My Page > ancestors'

Trim

 (error)

Server, Data Center

No

true

If set to false, the content will not be trimmed before being output (if appropriate).

Tutorial Examples