Can I use an image as a button for the Create From Template macro?

Similar to this old post I am trying to improve the look of a page by using images as buttons. When I generate a button via the 'create from template' macro and then take the URL is has and insert it as the URL for an image, it doesn't work. When I then click the image, it just takes me back to the dashboard of the Confluence instance I am using. The original button works fine when I click it though.

The URL the button generate looks like this:

1 answer

1 accepted

4 votes
Accepted answer

You could create a user macro to wrap your "create from template" button to override the styles on it.

Macro Body Processing:


## Developed by: Davin Studer
## Date created: 07/15/2015
## @param Image:title=Image URL|type=string|required=true|desc=The URL to the image.
## @param Width:title=Image Width|type=string|required=true|desc=The width of the image in px. (ex. 98)
## @param Height:title=Image Height|type=string|required=true|desc=The height of the image in px. (ex. 98)

#set( $id = $action.dateFormatter.calendar.timeInMillis )

<span id="button${id}">${body}</span>
#button${id} .aui-button.create-from-template-button, #button${id} .aui-button.create-from-template-button:active, #button${id} .aui-button.create-from-template-button:focus {
    background: url('${paramImage}') no-repeat;
    border: 0;
    text-indent: -999em;
    width: ${paramWidth}px;
    height: ${paramHeight}px;
    box-shadow: none;
    border-radius: 0;


Update: Added screenshot

image2015-7-15 16:28:44.png

Thanks for the suggestion. Would this work if I have multiple buttons on the same page? If it's not too much trouble could you expand on how I would apply this as I am pretty fresh to Confluence.

Davin Studer Community Champion Jul 15, 2015

It should work just fine with multiple create from template button ... although I have not tried it. You just need to create a user macro (Confluence Admin -> User Macros) and use the above code. Then put the user macro on the page, fill in the macro parameters, and put your create from template macro inside it. See the above screen shot that I have added.

Awesome! Works great, thanks heaps for throwing that together. Any tips on how I can get the buttons side by side with a small gap between them? At the moment your wrapper macro takes up an entire line and when the page saves the buttons are all on top of each other. I've tried leaving no gap and not putting a space but no dice.

Oh and my sharp cornered buttons now have a tiny curve on their corners now. No big deal, just letting you know.

Davin Studer Community Champion Jul 16, 2015

I have edited the above user macro for your issues. The corner should not be rounded anymore. Also, when rendered they should show next to each other (inline). In the editor they won't be on the same line, but they should render on the same line when viewing the page.

Legend. Works perfectly now. Really appreciate that mate. My only dilemma now is that I have 2 buttons that use the Create from Template macros and one that is just an image with the createBlogpost URL behind it. Since the image does not have the macro wrapping around it, it is not aligned with the other 2 images on the page. Ill have to figure out how to align it without applying the code in your above macro.

I solved this by inserting the 3 column page layout area at the top of the page. If I put each button in it's own column and then have the rest of the page's macros and blueprints under these in the normal page layouts I can have them evenly spaced and on the same horizontal plane!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

895 views 45 7
Join discussion

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