Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to specify "parent of the current page" in "create from template" URL?

Michelle Rau good
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 3, 2019

Hi, I'm wondering if there's a way to specify "parent of the current page" when creating a URL to create a page from a template.

I know it's possible to specify the template and parent page by using this syntax:

https://yourConfluenceAddress/pages/createpage-entervariables.action?templateId=XXXXXXX&spaceKey=YYYY&newSpaceKey=YYYY&fromPageId=ZZZZZZZZ

Is there something I can use instead of "&fromPageId=ZZZZZZZZ" to specify that the new page from template should be created under whatever page the user is on?

This could help encourage use of the page templates so I would like to know if it's possible. Thanks in advance!

3 answers

0 votes
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.
March 15, 2021

Hi @Michelle Rau good , not sure if I'm late to the party but Add page macro from ServiceRocket's Linking for Confluence app creates a link on your page which, when clicked, is equivalent to clicking Create Page button, while at the same time can define the page that you would like to be the parent of the new page, even if it's on a different space. 

Check out the documentation here (the function is under the Parent parameter)

https://docs.servicerocket.com/linking/macro-reference/add-page

Hope that helps!

Cheers,
Monique

0 votes
Alexander Horn February 14, 2020

Hi Michelle,

 

try out this code snippets inside your macro:

 

## @Param PageID:title=Target parent page|type=int|required=false|desc=Select a parent page ID where created pages will be stored as childs. If empty, current page will be assumed.

 

## Set current page as parent, if not set by user
#if ( !$paramPageID)
#set ( $paramPageID = $content.id )
#end

 

https://yourConfluenceAddress/pages/createpage-entervariables.action?templateId=XXXXXXX&spaceKey=YYYY&newSpaceKey=YYYY&fromPageId=$paramPageID

 

best regards

Alex

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 16, 2019

Hello Michelle,

This is an interesting idea, to create a template page from the URL formatted with an assigned parent. My ask to understand would be, why are we using a URL instead of allowing the user to select the template which will automatically inherit the parent page?

Additionally, there is the Create from Template Macro which allows you to specify the template and then from a single click create that template within the parent page. Further information on this may be found at Create from Template Macro.

We look forward to hearing back.

Regards,
Stephen Sifers

Michelle Rau good
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.
January 7, 2020

Hi Stephen, I'm back from holidays and I should clarify my question.

1. The use case for using a URL to create a page from template: I can add this link to the sidebar with other space shortcuts, or any place where the "create from template" button cannot be inserted. (Long story short, this helped resolve a squabble between the "child page" and "page tree" fans, since the page tree view doesn't by default include a link to "create a child page." The "new child page" URL points to a specific template I want users to use instead of creating blank pages.)

2. Use case for specifying a specific parent: we are introducing some new forms/templates and we want all pages of the same type housed under the same parent, because that's how our users are browsing for them. For example, if someone wants to create a new page about a specific tool, that page should go under the "toolbox" page.

3. Use case for using a URL that specifies "under the parent page of this page": By default new pages are child pages "under" the current page. A URL like this could create a new page "next to" the current page, i.e. at the same level in the hierarchy.

I hope that helps clarify. 

Not to complicate this question, but with that URL syntax, is it possible to create a page in space 1 from a template in space 2 (as long as they're both in the same Confluence wiki)?

sidebar_links.png

Like Stephen Sifers likes this
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 7, 2020

Hello Michelle,

Glad to hear you’re back from the holidays. Thank you for your additional clarification and use cases you have, they are very interesting and understandable.

Without using the create from template macro there is an alternative that will require some developer effort. This would be to apply customer javascript to pages and spaces and utilize the REST API or Java API to accomplish your goal. Further information on this may be found at;

An alternative to this would be to browse the marketplace for an app that may accommodate when you’re looking for. Here is a preset search within the marketplace for Atlassian Marketplace | Template Links.

While not a direct answer on how to remove the fromPageId requirement from the URL that you’re looking for, I do hope that these references prove helpful.

Regards,
Stephen Sifers

Like # people like this
Michelle Rau good
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.
January 7, 2020

Thank you! Our current system is workable, I'm always trying to find ways to make it easier for users to put the pages in the right place. :-)

I did discover that it's possible to create a page in one space using the template in another. All that's required is the templateId and the destination spaceKey, for example,

https://mysite.com/confluence/pages/createpage-entervariables.action?templateId=1140916288&spaceKey=MySpace&title=New_page

This could possibly allow us to build a "template library" that could be used to create pages in different spaces, provided that the templates are self-contained.

Like Stephen Sifers likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events