Sometimes, it is required to dynamically allocate the macro content for template purposes or other reasons (e.g., when documenting many similar things, like micro services). To achieve this, it is necessary to make the macros' parameters externally available. In the following section, we present examples that help you to create these templates.
Use Case: Create Pages from a Template for Micro Services with 'Include Bitbucket Server for Confluence' Macros
Every micro service page should contain 3 'Include Bitbucket Server for Confluence' macros:
In the administration section go to the user macro section
Create new user macro
Define name and title for the user macro
Fill in the code in the mandatory template field. The template content depends on what you like to include. The following examples show some possibilities. It is important to define the required parameters so that you can access them via the user macro
Here are code examples to add instances of the Bitbucket file path, Bitbucket branch list and Bitbucket commits macro:
Include Bitbucket file path with User Macro Template Syntax
Include Bitbucket branch list with User Macro Template Syntax
CODE
## This is an example macro
## @param repoSlug=Name|type=string|required=true
## @param projectKey=Name|type=string|required=true
<ac:structured-macro ac:name="stashbranches">
<ac:parameter ac:name="repoSlug">$paramrepoSlug</ac:parameter>
<ac:parameter ac:name="projectKey">$paramprojectKey</ac:parameter>
</ac:structured-macro>
Then, go to your template. The following definition of Wiki markup makes the rendering of the Include macro possible :