This example demonstrates how to create a user macro that displays the text 'Hello World!' and any text that the user places in the body of the macro.

Before you start, see Writing user macros for an introduction to creating your own user macros. 

Defining the 'Hello World' user macro

To create the 'Hello World' user macro:

  1. Go to  > General Configuration > User Macros.
  2. Choose Create a User Macro.
  3. Enter the macro details (see table below)
  4. Choose Add.

FieldValue
Macro namehelloworld
VisibilityVisible to all users in the Macro Browser
Macro TitleHello World
DescriptionDisplays "Hello World" and the macro body.
CategoriesConfluence Content
Icon URLYou can leave this field blank
Documentation URLYou can leave this field blank
Macro body processingRendered
Template

Enter the code below in the template field - this example will print the text straight onto the page.

## @noparams
Hello World!
$body

If you wanted the text to appear in a panel you could include the relevant AUI message class as shown here.

## @noparams
<div class="aui-message closeable">
Hello World!
$body
</div>

Using the 'Hello World' macro on a page

Now you can add the macro to your Confluence page using the Macro Browser, or by typing {hello in the editor and selecting the macro from the list of suggestions.

The result is:

If you chose to include a panel, the result would be:

  • No labels