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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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!

2 answers

0 votes

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

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

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

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

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

480 views 24 9
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you