Create blueprint with child page(s)

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.
March 21, 2016

I've gone through the various Write a Confluence Blueprint tutorials. However, one item that isn't there that I need is the ability to create child pages under the parent.

For example, taking the tutorial with the simplebp, you create the page with the table using the blueprint. You are then editing that page. After the page is saved (or whenever is appropriate), I want to create Child A, B, and C as children under the simplebp page. How can I do that?

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Neil Martin March 20, 2017

I am also looking for a solution with this issue to be able to create Child Pages underneath a blueprint. Anybody else come up with a solution that does not involve a third party plugin and therefore no cost involved?

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.
March 20, 2017

I never found a solution using Atlassian's available solutions. What I ended up doing instead was creating a template that users would create the initial page from. After that, I created a custom Python script that used the Atlassian REST API to generate and populate the child pages (I set it to run once a day from our Confluence server). This also allowed me to modify the pages to update content as needed.

Robert Reiner _smartics_
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 26, 2017

You could write a plugin that creates additional pages on creation of a page based on a given blueprint or on a certain event. This is basically the approach Mark describes, but you run it from "the inside" of Confluence.

Here are the classes you'll probably need to start with:

  • com.atlassian.confluence.plugins.createcontent.ContentBlueprintManager
  • com.atlassian.confluence.plugins.createcontent.api.services.ContentBlueprintService
  • com.atlassian.confluence.plugins.createcontent.services.model.CreateBlueprintPageEntity

The basic idea is to create a new page based on a blueprint and add it as a child to the new page.

I use this approach when I need to create additional pages for space blueprints (based on our commercial add-on), but it should also work similarly for page blueprints. Maybe there are easier ways to create pages with the Java API I'm not aware of ... 

If you are new to plugin development, here is how to get started: https://developer.atlassian.com/confdev/confluence-plugin-guide

Neil Martin June 9, 2017

Thanks for all the information and different approaches to resolve this. 

Irakli Edjibia June 14, 2017

Hi guys,
i´m facing the same issue trying to create a space Blueprint with multiple child pages.
What i´ve already got working is a Blueprint with the home page, i also can already react to the SpaceCreateEvent in my EventListener.
Now the problem is this event is triggered every time a space is created, so i need to somehow check whether the space was creating with my blueprint or somehow different.
I´ve also found a event called "SpaceBlueprintHomePageCreateEvent" but this isn´t documented anywhere and won´t be documented any time soon (https://jira.atlassian.com/browse/CONFSERVER-36797)
:-/ so i´m not sure if its safe to use or it will be removed without any comment in a future update.
My next idea was to add some kinde of "identifier" to the Spacekey during creation.
For example:
SpaceName: Customer Dokumentation
SpaceKey(entered by user): cusdoc
ModiefiedSpaceKey: cusdoc_genbybp
or something like that. But unfortunatly my javascript skills are not present at all^^ so i´m struggling hard trying to implement this >.<
So i would really be glad about some hints how to make this javascript magic happen or any different approaches on how to identify whether the space was created with my blueprint! =)
Thanks for your help !

best regards

Irakli Edjibia

Robert Reiner _smartics_
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.
June 14, 2017

I think the use case of this question is to add more than one page if a page blueprint is in charge. If you need to create multiple pages for a space, a space blueprint should do the job out of the box (if your use case does not require some runtime information).

Use <content-template ref="my-template" /> inside a blueprint element in the atlassian-plugin.xml. my-template is the key of a content-template element.

Here is a related question with some code:

https://community.atlassian.com/t5/Answers-Developer-Questions/Blueprint-with-multiple-child-pages/qaq-p/521282

Irakli Edjibia June 14, 2017

Thank you will try that tomorrow =)

Robert Reiner _smartics_
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.
June 14, 2017

You could also have a look at one of our examples on Bitbucket: https://bitbucket.org/account/user/smartics/projects/PDACA

For instance: https://bitbucket.org/smartics/smartics-projectdoc-confluence-space-prjmgmt/src/669e82b9750fdc21c399da37692fc8dc2b4852c4/src/main/resources/atlassian-plugin.xml?at=master&fileviewer=file-view-default

The add-on would require require the commercial projectdoc Toolbox to run (because of the macros added to the templates), but the source code is no different. 

0 votes
Nino April 11, 2016
do you have a solution?
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.
March 22, 2016

Hi Mark,
With our plugin Page Tree Creator (PTC) you can create template page trees with embedded PTC Buttons. The buttons are used to create child pages within the page tree. Have a look at the example under the following link:

CustomerXYZ Management (the buttons are on the right side, e.g. Create project kickoff)

You can test the example with the following sequence:

  1. Click this link
  2. Press the button "Create Product / Project structure"
  3. Create the page tree by clicking "Create new page tree"
  4. Go to the page "CustomerXYZ Management"
  5. Press the button "Create project kickoff" and the child page "Cl05.44033 Projektgründung" get created.

And the best is, you don't need any programming skills. The Page Tree Creator works with normal Confluence pages. So everybody which have the permission can improve the templates.

Regards,
Stephan

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.
March 28, 2016

Thanks, but that doesn't solve the problem as it requires someone to manually create it still with a button click. Plus, it's a paid plugin, and I have no budget for additional plugins.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events