Create from Template and Specify Parent Page

MarkC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2013

I really like the Create from Template macro, but it has its limitations. Here is what I want to do:

When the user clicks the button, a new page is created using a defined template and it is created under a specific parent page in, perhaps, another space.

For the macro itself, the user would have to specify the following parameters:

  • Space - The space where the template will be created (it would be nice to know how to create an autopopulating field as the user types space names)
  • Parent Page - The page within the space where all new content created from the template will be placed under
  • Template - The template to be used, of course
  • Button Text - The text on the button

Essentially it's nearly identical to the Create from Template macro, but it would allow a user to specify the parent page within a space under which the content is added.

I have tried, albeit unsuccessfully, to accomplish this. The best solution I have right now (as a band-aid until we have something more stable) is to create a new page using the template under the parent page. I then use that link as the place the button directs the user. It works, but it's sloppy and not easy for other users to make use of.

Has anyone created a macro like this? I can do most of the above, but I can't get the space to populate on its own or figure out how to specify the parent page. Any and all help is much appreciated!

11 answers

11 votes
AdrianaF November 11, 2014

I need to be able to specify the parent page. Desperately need this feature. Thanks!

7 votes
Angus Law April 9, 2015

 

I've just used this workaround in Confluence 5.5 and can confirm it works:

Take the URL from the normal create from template macro and change

&fromPageId=#######

to the id of the desired parent. You can then use a macro such as UI Button from RefinedWiki UI Toolkit to make it look nice :)

Donata De Luca May 11, 2015

Can you elaborate please? Would love to use a workaround, but there is no URL in the Edit window for "Create from template" Macro. Thanks.

Angus Law May 11, 2015

Apologies - I should have made it clear. This workaround doesn't actually use the "Create from template" macro, aside from to generate the original "create" URL. Here's the steps (should hopefully make more sense): 1. Add the Create from Template macro as usual, customising whatever settings you want, and preview or save the page 2. Right click on the button you just created and click "Copy link address" 3. Paste this address somewhere, e.g. Notepad. Example address: http://your-confluence-server/?templateId=4030475&spaceKey=TEST 4. Find the Id of the desired parent page (e.g. 123456) 5. Add &fromPageId=####### to the end of the address you pasted to Notepad (the example above would now be http://your-confluence-server/?templateId=4030475&spaceKey=TEST&fromPageId=123456) 6. Add this new address as a link to your Confluence page. Links aren't quite as fun as buttons, hence why I recommended using the UI Button from RefinedWiki UI Toolkit

Like Alper Aydın likes this
Donata De Luca May 11, 2015

Thanks, Angus! One other change I needed to make to get it to work: - I needed to actually click the button which the Macro created in order to get the full URL of https://[your-confluence-server].atlassian.net/wiki/pages/createpage-entervariables.action?templateId=[yourTemplateID]&spaceKey=[yourSpaceKey] - From there I could add the &fromPageId=[yourPageID] to the end, so the full URL looks like: https://[your-confluence-server].atlassian.net/wiki/pages/createpage-entervariables.action?templateId=[yourTemplateID]&spaceKey=[yourSpaceKey]&fromPageId=[yourPageID]

Like # people like this
Angus Law May 11, 2015

Good to hear you got it working - that'll teach me not to test my examples!

Chris David
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 18, 2015

I've tried this work around, but it seems that no matter what I put for the &frompageid when I click on the new link it always takes me back to the space homepage (doesn't even try to let me enter the template). I have full access to the space and am on 5.6.4. Any ideas?

eyrisone September 23, 2015

I'm having the same issue as Chris. I'm on a hosted instance. Any ideas?

Angus Law September 23, 2015

Did you both follow Donata De Luca's workaround above? My answer has a mistake. Otherwise I'm afraid I don't know!

Honda_Mx_Racer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 26, 2016

When I use the UI Button Hyperlink button and add the URL, it replaces the '&' with '&'. Did you have this same problem? If so, what did you do to get around the issue. 

Wanjae Shin August 9, 2016

@Honda Mx Racer I used the same macro and didn't encounter the issue...thanks everyone!

Mgk Seqis
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 6, 2016

The "Create from Template" Macro was linked to following URL:

https://[my-confluence-server]/?templateId=10780750&spaceKey=ABC&newSpaceKey=ABC&title=%3CPageTitle%3E

I added the fromPageId mentioned by Angus and took the Path mentioned in Donata's post.  This modified string creates a new template with the given Parent page: 

https://[my-confluence-server]/pages/createpage-entervariables.action?templateId=10780750&spaceKey=ABC&newSpaceKey=ABC&title=%3CPageTitle%3E&fromPageId=10457192

Thank you both!

 

 

Like # people like this
Greg Der Ananian
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 17, 2019

I'd like to specify it be created in the same space but with no parent page. Is there a PageId for "none?"

Or, can have new pages in a space default to orphan pages?

Kelly O'Connell
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 4, 2020

I have used this workaround for years, but with the latest updates released, it no longer works! Has anyone found a new way to specify the parent page for a Create from Template macro?

Like # people like this
Joshua Geldenhuys
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 5, 2020

@Kelly O'Connell mine is also broken since the latest updates. I did some very brief troubleshooting and, unfortunately, haven't found an additional workaround yet.

Strangely - I found that it still works if the user chooses to open the link in a new tab (at least on Chrome browser).

Like Michael Schönacher likes this
Michael Schönacher
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 16, 2020

i have the exact same problem! 
appreciate any hints - thx!

joel strouts
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 29, 2020

Well damn, this feature would be greatly helpful but the workaround suggested here does not work for me either.

Deleted user June 30, 2020

I am having the same issue. The generated link works fine if I paste it into the browser or if I right click the link in the published page and select to open in a new window. If I click the link I get taken to an empty page with the default title but none of the template content is loaded and I get a connection error. I have tried removing the "s" from "https://" and every url variation I can think of. Has anyone had any more luck? 

4 votes
Sarah Sand October 8, 2018

Just wanted to say thank you all again for answering this question! It's been very helpful to my team.

And as a recap, here's the URL we use with the RefinedWiki UI Button:

https://[your confluence url]/pages/createpage-entervariables.action?templateId=[template id]&spaceKey=[space key]&newSpaceKey=[same space key]&title=%3C[whatever you want the default page title to be]%3E&fromPageId=[page id]

Andrey_Aristarkhov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 26, 2020

Thanks! Works for me even with latest confluence updates!

Pierre Zurmely
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 18, 2020

Same here for version data center 6.13.10. Thank you!

Ulrik Schoth March 3, 2023

Still works for Confluence version data center 7.13.11.

Thank you all! 👍😃

1 vote
Monique Khairuliana[ServiceRocket]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2021

ServiceRocket's Linking plugin can do this through its key macros "Add page" or "Add page via Form". Both macros let you use a template as a source and specify the target parent page for the new page. There are also three special values that you may set it with:

  • @self - the current page.

  • @parent - the parent of the current page.

  • @home - the space home page.

The app is available on Server, Data Center, and Cloud.

Hope that helps!

Monique
-ServiceRocket product team

1 vote
Wierzchowska Natalia
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 23, 2017

To have the button instead of the link, you can use wikimarkup macro with html and css code. I will publish it once I have it

FredrikLiljemark July 31, 2018

Do u have it? ;)

FredrikLiljemark March 5, 2023

@Wierzchowska Natalia do you have it now? =)

Ulrik Schoth March 6, 2023

Hi @FredrikLiljemark

to create a button, the following code works for me. Just paste it into the body of an HTML macro.

  • PLACE-THE-LINK-HERE needs to be replaced with the link, e. g. as described in @Sarah Sand's post.
  • For more information on button design, see Atlassian.
<button onclick="openTemplateLink()" class="aui-button aui-button-primary" title="Create from template with configurable parent">Create new page</button>

<script>
function openTemplateLink() {
window.open('PLACE-THE-LINK-HERE', '_blank');
}
</script>
Like FredrikLiljemark likes this
FredrikLiljemark March 6, 2023

Thanks !=)

Like Ulrik Schoth likes this
0 votes
Laura Minniear January 29, 2021

It seems ridiculous to not be able to use a template to create a child page. Either add an option to use template when using the "+" method of adding a child page from the space navigation sidebar, or have the Template button create the page under the current page you're on instead of at the top level of the space. The latter was the way Confluence worked at my last company, but perhaps that was customized behavior?

Templates are useless if you can't create pages where you want them to go. It is not feasible to have to create the page and then move it every time.

Laura Minniear February 1, 2021

UPDATE: I realized that when you create a child page using "+", you can apply a template on the new page. Use the template panel that shows on the right to select and apply a template - it will convert the new page immediately.

0 votes
Tim Graffam January 11, 2021

While I was able get the "fromPageId" workaround to work, has anyone figured out how to do this using variables for the page title? For example, I would like the title to always fill in with @currentDate instead of something static.

Thanks!

Adrian Bardue
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 4, 2021

I have tried to create a link with multiple of the above workarounds and it has not worked for me at all (either creating and old, blank page without the template or just not working). Can you tell me exactly what format you used that you found to work? Thank you!

0 votes
Joshua Geldenhuys
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 16, 2019

If you're one of those who tried this workaround without success, here's a small tip that worked for me:

1. Copy the same URL example as posted by @Sarah Sand and edit with your specifics on a Notepad:

https://[your confluence url]/pages/createpage-entervariables.action?templateId=[template id]&spaceKey=[space key]&newSpaceKey=[same space key]&title=%3C[whatever you want the default page title to be]%3E&fromPageId=[page id]

2. Remove the "s" from "https" at the beginning of the URL. Your URL would then be "http://......."

3. Copy the modified URL into your proposed web link.

4. Save and test.

If you want to go as far as creating a button-like feature, follow the tips posted above. I just added a "+" emoticon from the Confluence editor, which looked quite neat as well.

Daniel Vlad August 12, 2024

Thank you for your instructions. It works.


Now I would like to achieve that the mask with the placeholders appears first, when the template is called and not just the empty template.
Any idea how I could realize this?

0 votes
Piotr Pilakowski
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 16, 2019

Hi all - thanks for your answers, they were really useful.

I just have one more question about how to deal with blueprint links. Especially How-to article.

 

Link to such template looks slightly different as it adds dialog box part to the url:

 

https://[confluence url]?createDialogSpaceKey=[SpaceKey]&createDialogBlueprintId=63826ec0-686e-4aa7-94ec-9c5e7ea39f7c

I tried to add "fromPageId=[pageID]" in here (in all possible places) but it seems to ignore it.

The dialog box appears and new page is created as a children to a current one.

Anyone has the idea how to deal with Blueprints?

Jason Mckelvey
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 1, 2019

Yes. This.

I am unable to use the suggested URLs because we use BlueprintIds. I've been messing with a lot of options, but cannot seem to figure it out. Hoping someone will be able to shed some light on this use case.

If I figure something out, I'll be sure to respond.

0 votes
Ron Holmes
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 25, 2017

Another option to get your link into a button is to embed it in a div.

I used the following style information
background-color: #EEE; border-radius: 4px; border: solid 1px;color: #DDD;padding: 5px 15px;text-color:white;text-align: center;text-decoration: none;display: inline-block;font-size: 14px;margin: 4px 2px;cursor: pointer;

Chris Morlier
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 16, 2018

I did something similar using the background color macro, which has an option to specify the class.  So I used the same classes that were applied to the button that was created by the Create from Template macro.

Just add the class "aui-button".  I originally had the "create-from-template-button" class as well, but after testing I found it changes the behavior, so leave it out.

This gave me a link that looks like the button, and presumably would work if the theme is changed.

To get the full effect, you will also need to change the text color of the hyperlink to black.

Chris Morlier
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 16, 2018

Just tried with the Div Macro as well, and worked the same.  However, I couldn't get the hyperlink color to change with the standard text color tool.

0 votes
EPS Software Engineering AG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 1, 2015

Have a look at the Page Tree Creator Plugin. It can do multiple Template Pages, has a Search & Replace process and in the button you can set the parent page (even in an other space ) as destination.

https://marketplace.atlassian.com/plugins/eps.focuspro.PageTreeCreator/server/overview

With the Space Tree Creator plugin you can create a space and then copy the Page Tree to this new space.

https://marketplace.atlassian.com/plugins/eps.focuspro.SpaceTreeCreator/server/overview

 

 

MarkC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 2, 2015

Paid plugins are not an option for us, as it just continues to drive up the cost of the tool that should be able to do many of these things.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events