Create template which creates page directly in parent-page
Asked by Philippe Desorgues:

Dear community,

I am trying to create a template in Confluence, which upon creation of the page by a user, would automatically be created in the correct parent page. This template would be accessible in the main menu for page creation, but when a user create this template, it would be automatically created in the correct sub-page.

Is there a Macro which enables this? I have tried the "create from template macro" but it does not seem to have the functionality required. The "space-ID" level in this macro is too high for what I am trying to do, I want to link to sub-pages within this space.

Thanks,  
Philippe


Answers:
author: Robert Reiner _smartics_
body: **First option**

The commerical [projectdoc Toolbox](https://www.smartics.eu/confluence/x/1YEp) for Confluence Server allows to define a homepage for pages for a given [doctype](https://www.smartics.eu/confluence/x/pYmj). A doctype is a [page blueprint](https://developer.atlassian.com/server/confluence/confluence-blueprints/) with some extras (a standard page blueprint or user template would not work). A doctype provides such a homepage by default (this is similar to the index page). If the default homepage does not meet your requirements, the homepage can be selected per space by the use of a [space property](https://www.smartics.eu/confluence/x/jwNk).

The tip [Specify Doctype Homepage](https://www.smartics.eu/confluence/x/RASaAg) shows how this feature works.

Please note that I am an author of the projectdoc Toolbox (which is [available on the Atlassian Marketplace](https://marketplace.atlassian.com/1212629)), so my views are certainly biased ... :)

**Second option**

This does not meet the requirement you have described, but if the location of the page is less important than the option to find a page from a well-known page, then maybe the *index page* of a page blueprint would work for your use case?
> The first time a blueprint template is used in a space, Confluence creates an index page and adds a shortcut to your sidebar. The index displays a list of pages made with the template, and selected information from your template pages.
>
> [Blueprints and User Created Templates](https://confluence.atlassian.com/confcloud/blueprints-and-user-created-templates-724764985.html)

The index page can customized. So if it is only relevant that there is a page that lists all pages of a given kind, then this would be the easier option (no third-party add-on required).


author: EPS Software Engineering AG
body: Hi Philippe,

You could use our [Space](https://marketplace.atlassian.com/apps/1214324/space-tree-creator-copy-space?hosting=server&tab=overview) and [Page Tree Creator](https://marketplace.atlassian.com/apps/1214062/page-tree-creator-blueprint-creator?hosting=server&tab=overview) App for Confluence. The two apps provide exactly the functionality your are looking for.

You can find the apps on Marketplace and there is also a link to our examples, where you can test the apps easy and fast.

Regards,  
Stephan (CEO of EPS Software Engineering AG, the vendor of the apps)


author: Victor Mutambuki
body: Philippe,

You can create a [template](https://confluence.atlassian.com/doc/page-templates-296093785.html) in your space that you can use to create pages.

Look more about the two categories of page templates.

Victor

comments: author: Philippe Desorgues
body: Hello Victor,

Thanks for your response. I know how to create a template but I don"t know how to link this template to a sub-page upon creation.

The page you suggest does not provide this explanation I believe....


author: Victor Mutambuki
body: Philippe,

The template that you create, do you want it to be a global one or specifically a space template?

Victor


author: Philippe Desorgues
body: Hello victor,

I want it to be created in a specific parent page automatically, as the users will not know in which parent-page this template has to go.

Thanks for your help!

Philippe


author: Philippe Desorgues
body: And i mean parent page not space, as in my space I have multiple parent-pages, but the users do not know in which parent page the template has to be classified.


author: Victor Mutambuki
body: ![Screen Shot 2018-06-25 at 8.15.08 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/25316i9CF0FD010063DF33/image-dimensions/449x352?v=v2 "Screen Shot 2018-06-25 at 8.15.08 AM.png")

Phillipe,

In that case, add the template to the space. Please see attached image.

Victor


author: Philippe Desorgues
body: Yes thank you. But how can I add this template automatically to a sub-page within this space?


author: Victor Mutambuki
body: Philippe,

Do you mean a child page or parent page? I'm not familiar with a sub-page.

Victor


author: Philippe Desorgues
body: I mean create a child page automatically within a parent page!

Thanks,  
Philippe


author: Victor Mutambuki
body: Philippe,

I don't know if you can do so automatically. Why not create a child page under the parent page that you intend to? Why create child pages automatically

Victor


author: Philippe Desorgues
body: he problem is that in our space we have many parent pages, so the people are not sure in which parent page the templates should go upon creation....


author: Victor Mutambuki
body: Philippe,

As far as i know, if you have a space template, it can be used in it. However, i do not know of a way a space template can be used to create child pages automatically.

Victor


author: Philippe Desorgues
body: Ok thanks Victor it is what I thought. I will have to find a different way then.

Philippe


author: Peter_Baschan
body: Hi [@Philippe Desorgues](/t5/user/viewprofilepage/user-id/1445454)

There is a way to do this. Using this method you can add a link to any page and specify exactly where you want your new page created.

1. Create the template you want users to use to create a new page.

2. On the content tools/template page copy the URL of this link to a notepad and note down the pageId

3. Locate and open the parent page where you want your users to create child pages/

4. Right click and select 'View page source'

5. Locate and note down the pageId (it should be around line 49).

6. In a notepad create a URL using this syntax: https://yourConfluenceAddress/pages/createpage-entervariables.action?templateId=XXXXXXX\&spaceKey=YYYY\&newSpaceKey=YYYY\&fromPageId=ZZZZZZZZ

* where 'yourConfluenceAddress' = the URL to your system
* templateId = the noted templateId
* spaceKey = the space you are in (again you can take it from your browser URL)
* newSpaceKey = the same space as you are in
* fromPageId = the noted parent's page Id

7. You can add this URL as a link to any of the pages within your space and it will create the child page under the pre-defined parent. Perfect for a home page with instruction for example.


author: Adam Bartlett
body: Really useful. Thanks Peter.


author: Hanneke Kaashoek
body: Hi,

I'm using the create from template macro on the overview page of a space. I would like to use this URL mentioned by Peter Baschan to make sure the created pages will be created under the pre-defined parent page. Where do I mention this URL exactly? Thank you in advance!


author: Peter_Baschan
body: Hi.

For the URL above you don't have to use the Create from template macro. Once you constructed the URL you can add it as a standard link object anywhere on the page (there is a link icon within your toolbar or navigate to the place where you want your link and press CRTL+K).

I hope that helps.

Peter


author: Hanneke Kaashoek
body: Yes, that helps! Thank you.

Unfortunately I created a 'dead link'... I took the pageID from the URL, instead of the page source information because in the page source there is nowhere an ID mentioned?

It is quite unfortunate that you can't just select the parent page when editing the create from template macro. That would fix this entire problem :)

Hanneke


author: Stephanie Willis
body: I'm having the same issue as [@Hanneke Kaashoek](/t5/user/viewprofilepage/user-id/3755975) - using the new page editor, the source does not show the PageID anywhere. I tried taking it from the URL and it doesn't work.


author: Matt C. Wilson
body: A recent [exploit has targeted the createpage-entervariables.action endpoint](https://therecord.media/confluence-enterprise-servers-targeted-with-recent-vulnerability/), which means it may be blocked or not working for you.  

Here is an alternative workaround, but it does not pre-select the template.  

1. Go to the desired target parent page.  
2. Copy the URL and tack ?createBlankFabricPage=true onto the end.  


author: Scott Beeson
body: It appears this URL hack no longer works. Also, it doesn't work if you try to include variables like @currentDate, etc.


author: Micheline Mendoza
body: Yes it seems this URL hack does not work anymore.