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?
Thanks,
-Peter
## 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=http://rhosvr01.rhotrading.com/xrtradingwatermark.png|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 - https://jira.atlassian.com/browse/CONF-23704)
#if(!$paramImagePath)
#set($paramImagePath = http://rhosvr01.rhotrading.com/xrtradingwatermark.png)
#end
#if(!$paramRepeatBehaviour)
#set($paramRepeatBehaviour = no-repeat)
#end
##Check for absolute image path or just image file name
#if ($paramImagePath.startsWith(http))
#set($imgsrc=$paramImagePath)
#else
#set($imgsrc = $config.getBaseUrl() + / + $content.getAttachmentNamed(${paramImagePath}).getDownloadPathWithoutVersion())
#end
<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');
});
</script>
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
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 - https://confluence.atlassian.com/display/DOC/Customising+Space+Layouts. 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:
$helper.renderConfluenceMacro("{myusermacroname}")
This is similar to the codes discussed in here - https://answers.atlassian.com/questions/39911/helper-renderconfluencemacro-recently-updated-type-news-author-action-user-name-max-10-theme-sidebar-spaces.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.