Example User Macro - Hello World

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.

Field Value
Macro name helloworld
Visibility Visible to all users in the Macro Browser
Macro Title Hello World
Description Displays "Hello World" and the macro body.
Categories Confluence Content
Icon URL You can leave this field blank
Documentation URL You can leave this field blank
Macro body processing Rendered

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

## @noparams
Hello World!

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!

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:

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport