Param Include for Confluence: Best Practices and Examples

Written by

in

How to Use the Param Include Macro in Confluence The Confluence Include Page macro allows you to dynamically display the content of one page inside another, eliminating the need to maintain duplicate information. When writing advanced, custom reusable components—known as User Macros—the @param syntax acts as the bridge that lets authors pass unique parameters (like a target page title) into that inclusion template.

Using parameters with your inclusion logic ensures your team can build highly customizable dashboards, programmatic buttons, and modular documentation structures.

🛠️ Step 1: Define the Parameter in Your User Macro Template

To use a parameter to include or reference a page dynamically, you must first declare it using the @param metadata syntax in your User Macro template. This tells the Confluence Macro Browser what input field to show the user. Navigate to Confluence Administration > User Macros. Click Create a User Macro.

In the template body, use the confluence-content field type so users can select a page from a predictive search dropdown:

## @param TargetPage:title=Page to Include|type=confluence-content|required=true|desc=Search and select the Confluence page you want to reference or embed. Use code with caution. 💻 Step 2: Write the Inclusion Logic

Once the parameter is defined, you can fetch its value using the \(paramTargetPage</code> variable. If you are building a custom wrapper that embeds a standard <a href="https://confluence.atlassian.com/doc/include-page-macro-139514.html">Atlassian Confluence Include Page Macro</a>, you can render it programmatically via XHTML storage format rules:</p> <p><code><ac:structured-macro ac:name="include"> <ac:parameter ac:name="">\)paramTargetPage/ac:parameter /ac:structured-macro Use code with caution.

Note: The standard include macro handles the page title parsing automatically when passed through the placeholder variable. 📝 Step 3: Insert the Macro onto a Page

Once saved, any team member can easily reuse this component directly within the rich text editor.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *