Skip to end of banner
Go to start of banner

Hide If

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 21 Current »

Description

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

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

  • Some legacy Macro parameters from the Confluence Server are not supported yet. More details are on our FAQ page. 

  • In the Confluence Cloud, the legacy Macro parameters will be shown in a section that is accessible by showing and hiding the legacy field parameters dropdown.

  • If the migrated macro has no legacy parameters, the "Show legacy field parameters" dropdown will not be visible in the macro editor.

  • Though helpful in preventing certain content from being seen by specific users, this macro is not a comprehensive security solution. The user may be able to view the content easily via other means, such as editing the page. Be aware that content is only hidden in the Confluence page view and is still available when editing a page, viewing page history, email notifications, etc. To secure sensitive information, use the Security & Encryption app instead.

Parameters

Name

Required

Migratable to Cloud?

Default Value

Description

Start Date

(X)

NO

The date and time from when the content should start being hidden, with respect to the server's timezone.

image-20240129-123220.png

End Date

(X)

NO

The date and time from when the content should stop being hidden.

image-20240129-123230.png

Match Using

YES

YES

The default value is set to Any.

Set to "all” or “any.”

  • If set to any, only one of the specified restrictions must match.

  • If set to all, all the specified restrictions should match.

For example:

  • hide if (Match Using All)

User groups added - A, B, C

The "user“ should be part of all the groups A & B & C for the content to be hidden with the Match Using: All criteria. If the user is not part of C, then the content is not hidden in this scenario.

  • hide if (Match Using Any)

User groups added - A, B, C

The "user" can be part of any group (A, B, or C) for the content to be hidden with the Match Using: Any criteria.

hide-if.gif

Users

(X)

Select the list of users to match.

Special Username

(X)

The user to match, using unique usernames:

  • @anonymous - No user is currently logged in

  • @authenticated - Any authenticated user is logged in.

  • @self - The current user.

User Groups

(X)

YES

 

The list of user group(s) to match. Type the group name and select from the dropdown option. (Cloud only)

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

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

Space Permissions

(X)

NO

 

This property allows you to define whether the content" then followed by permission type, e.g., @self: view

  • Use the Space Key, 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

(X)

NO

 

The (list of) page types. May be:

  • page

  • blogpost

  • comment

  • spacedesc

Display Types

(X)

NO

 

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

The (list of) display modes:

  • default - content is hidden only in the Confluence default view.

  • printable - content is hidden only in the exported PDF or Word document.

For more detailed information on Display Types usage and behaviors, check the Display Types parameter matrix page.

Current Space

(X)

NO

 

The list of space keys for the spaces will be displayed.

Action Types

(X)

NO

 

The action is 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

(X)

NO

 

The list of labels to test is present or absent.

For more detailed information on Label usage and behaviors, check the Label parameter matrix page.

HTTP Headers

(X)

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 it 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

(X)

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

(X)

NO

false

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

Tutorial Examples

  • No labels