Adding Macro to all pages in a space

Hello, I have a user macro created, named {watermark}. The code for this macro is below. How can I add this macro to all pages in a space without having to go through each page and manually adding the macro to the page?



## Macro name: watermark

## Visibility: All users

## Categories: Formatting

## Body processing: No macro body


## Developed by: Charles Hall

## Date created: 21/05/2012

## Installed by: Charles Hall

## Define a watermark image for the current page

## @param ImagePath:title=Image path|type=string|required=true|default=|desc=Image file name of an attached image to this page, or full http path to the image to be used in the watermark. An opaque version of the OpenBet logo is the default.

## @param RepeatBehaviour:title=Repeat Behaviour|type=enum|enumValues=no-repeat,repeat,repeat-x,repeat-y,inherit|default=no-repeat|desc=Repeat option for the background image

## @param MinHeight:title=Minimum Height|type=string|required=false|desc=Minimum height to enforce for the page (so that all of the watermark image will be shown regardless of page content).

## Check default values (bug in Confluence -


#set($paramImagePath =



#set($paramRepeatBehaviour = no-repeat)


##Check for absolute image path or just image file name

#if ($paramImagePath.startsWith(http))



#set($imgsrc = $config.getBaseUrl() + / + $content.getAttachmentNamed(${paramImagePath}).getDownloadPathWithoutVersion())


<script type="text/javascript">

jQuery(document).ready(function() {

/*Default theme*/

jQuery('#content').css('background-image', 'url($imgsrc)');

jQuery('#content').css('background-repeat', 'repeat');

jQuery('#content').css('background-position', 'left top');

jQuery('#content').css('height', '50');

jQuery('#content').css('vertical-align', 'bottom');



2 answers

Hi Peter,

You can make use of the custom layouts, which is configurable for your space. This acts like a layout template for your Confluence pages - check out this documentation - The layout that you will most likely need is the 'Page Layout'.

Once you have identified where to put the macro, insert the following line to render the macro:


This is similar to the codes discussed in here -

If Azwandi's answer doesn't fit your situation and you do need to update pages, then see How to automate adding text to Confluence pages

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

64 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you