Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create a custom macro to create a page using from a template?

Rafer Gluyas May 11, 2025

I know how to create a template and I have a general idea of how to create a macro. 

What I want to do is create a macro that enables users to create a page using an already existing template.

Page templates are easy to  maintain, which means that any minor changes are easy to view in the WYSIWYG editor, which is why I want to do it this way rather than have a macro that contains the page content in code, and then creates the page using that. 

3 answers

3 votes
Chu Dam
Community Champion
May 12, 2025

hi @Rafer Gluyas 

there is no app install needed here, there is a native macro in Confluence to create a button to display on page, this button will create a new page based on an existing template: https://confluence.atlassian.com/doc/create-from-template-macro-317196995.html

I hope this help.
Dam

0 votes
Piyush Annadate _ACE Pune_
Community Champion
May 12, 2025

Hello @Rafer Gluyas ,
You can definitely use the process defined by @Roma Bubyakin _Wombats Corp_ 

Checkout Create from Template macro - https://support.atlassian.com/confluence-cloud/docs/insert-the-create-from-template-macro/     

0 votes
Roma Bubyakin _Wombats Corp_
Contributor
May 11, 2025

Hello Rafer,

You can use parametrized URL for creating page from template, see this post:

https://community.atlassian.com/forums/Confluence-questions/URL-or-hyperlink-to-page-creation-via-template/qaq-p/819221

Additionally, you can crate a User Macro with a button which will be the anchor for it. Macro user parameters might be utilized for selecting a template and/or space for the URL

Regards, Roman

Rafer Gluyas May 12, 2025

This is more what I was looking for, as I wanted to add in some logic behind the variables, extracting dates, incrementing (etc). 

Rafer Gluyas May 13, 2025

@Roma Bubyakin _Wombats Corp_ I misunderstood your answer and thought that this provided a way to fill in the variables, it does not, all it does is open the template with empty fields. 

Is there any way to send the variables through in the same call as well? 

Roma Bubyakin _Wombats Corp_
Contributor
May 14, 2025

Did you mean to fill the new page with variables?

This is how I add them to template:

2025-05-14_10-12.png

This is how I call page creation from template:

https://wombats.atlassian.net/wiki/pages/createpage-entervariables.action?templateId=461570049&spaceKey=DS&newSpaceKey=DS&title=My%20Title

This is how it looks for the user who clicked on it:

2025-05-14_10-13.png

 

But I do not find a way to "preset" values to variables by URL, for example

Rafer Gluyas May 14, 2025

@Roma Bubyakin _Wombats Corp_ I wanted to send the variables in the URL, as the majority of them can be derived from values in jira for each iteration. The only way I can see to do this is so far to try and create complicated macros with embedded html/markup. A really convoluted process for something that should be so simple!

Roma Bubyakin _Wombats Corp_
Contributor
May 14, 2025

Yeah, I was also wondering that URL does not support parameters.

If you have several options of values, you can create multiple templates and Macro button will select the needed one.

This is what come up at mind

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events