Stand with Ukraine 🇺🇦
Products
Services
Blog
About Us

Macro Visibility

Show and hide User Macro

Confluence macros offer the flexibility to control their visibility within the Macro Browser. This is particularly useful when you want to limit the visibility of certain macros to specific use cases or users without impacting their functionality.

Controlling Macro Visibility

The hidden property in the macro's configuration determines whether the macro is displayed in the Macro Browser:

  • Hidden: false (default): The macro is visible in the Macro Browser and can be easily discovered and added by users.

  • Hidden: true: The macro will not show in the Macro Browser but remains functional. Users can still use it if they know how to access it, through direct configuration or templates.

Screen Recording 2026-05-08 at 16.50.57.gif

When to Use the Hidden Setting

  • Hide rarely used macros to reduce clutter in the Macro Browser.

  • Limit access to advanced macros meant for specific workflows. E.g. macro used only by admins or some managers.

  • Maintain functionality for existing pages using the macro while preventing new instances from being created unintentionally.

  • Nested Macro: when a macro is used only as a nested in others as a “submacro”.

This configuration ensures that your Confluence environment remains organized and user-friendly while providing the flexibility to manage macros effectively.

Enable and disable User Macro

Managing user macros in Confluence Cloud is simple and intuitive. You can enable or disable macros directly from the list of all user macros, ensuring complete control over their availability and functionality in your Confluence instance. It’s a kind of soft delete.

On the starting page listing all user macros, the "Enabled" column features a toggle switch for each macro:

image-20260510-155112.png
  • Default: Enabled: The macro is fully registered with your Confluence instance. It appears in the Macro Browser, can be added to pages, and functions as expected.

  • Disabled: The macro is unregistered from the Confluence instance. It will:

    • It does not appear in the Macro Browser.

    • It does not work on pages where it is already in use. Instead, the placeholder text "Unknown macro: {macroKey}" will be displayed in its place.

      image-20250110-151941.png

Use Cases for Disabling Macros

  • Draft Work: Disable a macro while working on its configuration or testing before making it live.

  • Temporary Removal: The disable option is an alternative to deleting a macro, allowing you to retain its configuration within the "User Macro for Confluence Cloud" app.

Disabling a macro ensures it is inactive without losing its configuration, making it an ideal approach for testing and iterative development.

Show or hide macro content

Conditional rendering allows you to control the visibility of macro content based on specific conditions, such as user group membership, the page's rendering mode, or others. This enables you to tailor content display for different audiences or scenarios, ensuring flexibility and security in Confluence pages.

Use Case 1: Limit content based on permissions

User groups are the main pillar for permissions. You can customize content visibility based on the user's group membership. For example, sensitive information might be shown only to administrators:

#foreach ( $group in $user.groups )
    #if($group.name == "site-admins")
        #set($isAdmin = true)
    #end
#end

#if ( $isAdmin )
  Hello Admin! This is sensitive information 🤫 
#end
  • How It Works: This script checks if the user belongs to the site-admins group and, if so, displays the sensitive information block.

  • Use Case: Hide content from regular users while granting visibility to admins or specific groups.

Use Case 2: Hide content from the page, but show it in exports

You can control content visibility depending on whether the page is being viewed normally or rendered for exporting (e.g., PDF, Word, or other formats):

## renderMode is a variable that is empty in page view rendering

#if ( $renderMode )
  This block will be NOT rendered on the page
  But exported or printed (PDF, Word, Email, custom exporters)
#end
  • How It Works: The renderMode variable determines the current rendering context. When the page is exported or printed, the content inside the condition will appear, but it won’t be shown during regular viewing.

  • Use Case: Include additional information, annotations, or metadata specifically for exported documents without cluttering the normal page view.

Benefits of Conditional Rendering

  • Content Personalization: Deliver tailored content to specific user groups or export contexts.

  • Enhanced Security: Ensure sensitive information is accessible only to authorized users.

  • Optimized Exports: Add supplementary details or exclude unnecessary content for exported formats.

Conditional rendering in macros provides a versatile way to adapt your Confluence content dynamically, making it suitable for various audiences and formats.