• Article
  • Jul.2.2019

How to hide certain contents of a Confluence page from or show them to users

  • Jul.2.2019
  • Reading time mins

Visibility is an app developed by ServiceRocket and available on the Atlassian Marketplace. It allows one to display or hide sections of the contents of a Confluence page from a user according to different criteria, such as rights, group membership, page ownership, and even display mode and web browser properties.

The Visibility plugin has changed a lot since its first release. Many macros have disappeared in order to refocus on the essentials with “show-if” and “hide-if”. As their names indicate, these macros allow one to show or hide the contents of a page if certain conditions are satisfied.

The fact that it is free and has many use cases has made this app popular and widely used in implementations. You can decide to display parts of a page based on a team’s group membership, or simply leave instructions invisible in reading mode. Hidden information remains accessible via the “view source” action, so it is not a safe solution for hiding sensitive information.

But since January 2019, and version 5.0, Visibility has become a paid app. So if you are a user, be aware that when you reach the end of your license (or its renewal date), your app will not work unless you buy it. Fortunately it’s still affordable at $150 for 250 users, $1,000 for 10,000 users, and $1,500 for unlimited users.

If you prefer an alternative to this app, be aware that much of the functionality provided by Visibility can be natively covered with user macros.

The implementation achieved by these user macros does not entirely cover the scope offered by the Visibility app.

Here are the features included:

  • Named users
  • Group membership
  • Rights for a page or space
  • The type of display—Be careful, as only the PDF export will be available with the “printable” option
  • All conditions / one condition

A user macro is a macro that has been declared and defined by the Confluence administrator, and that can process content or display additional content. Creating a user macro requires some skill in development and knowing how to read the Java API.

Here we reveal how to replace Visibility with a native solution.

  1. First of all, you will have to disable the Visibility app, since it will be replaced by user macros
  2. You will have to modify the CSS to be able to choose to hide certain parts of the Confluence page during PDF export
  3. Finally, you will have to create 2 user macros

Let’s get to the heart of the action now.

Creating the “Hide-if” user macro

MODIFYING THE CSS

Adding CSS to the PDF Style of your instance

 

CREATING THE USER MACRO

Follow the instructions for creating a new user macro using the following settings:

Name of the macro: hide-if

Visibility: Visible to all users in the macro browser

Title of the macro: Hide-If

Description: Hide content when conditions are met

Categories: Confluence Content

Macro body processing: Rendered

Template

That’s it—your users can now hide parts of a Confluence page according to the conditions that they choose.

Creating the “Show-if” user macro

MODIFYING THE CSS

Adding CSS to the PDF Style of your instance

 

CREATING THE USER MACRO

Follow the instructions for creating a new user macro using the following settings:

Name of the macro: Show-if

Visibility: Visible to all users in the macro browser

Title of the macro: Show-if

Description: Show content when conditions are met

Categories: Confluence Content

Macro body processing: Rendered

Template

You will now be able to show content only if certain conditions are met.

The choice is yours

As you may have understood, depending on your situation and your internal resources, you can either buy the Visibility app or create a workaround by making two user macros that will provide you with essentially the same functionalites.

If you have any questions, don’t hesitate to contact our Atlassian Certified Consultants.

Contact us

Related resources

View all resources