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

Adding a page title to a confluence blueprint

Alex Yasurek
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 11, 2014

Hi,

I have followed the three blueprint tutorials (simple, intermidiate, and advanced) and everything works fine. The one thing I have not been able to figure out is how to add a page title to the blueprint. I would like the page title to be a mixture of text provider by the user in the create page dialog wizard and my own text.

Example: user enters a product name in one of the input fields in the blueprint create dialog wizard and I add "Release notes 2014" so the page title would be "Product Release Notes 2014".

So essentially i want to be able to grab a value from one of the inputs, concat some text to it and make it the page title of the page created.

Thanks

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
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 12, 2014

I think you should extend com.atlassian.confluence.plugins.createcontent.api.contextproviders.AbstractBlueprintContextProvider.

There you override updateBlueprintContext(...).

Some pseudo code:

@Override
protected BlueprintContext updateBlueprintContext(
    final BlueprintContext blueprintContext) {
    final String someValue = blueprintContext.get("someKey")
    final String title = "xxx" + someValue;
    blueprintContext.setTitle(title);
    blueprintContext.put("somethingElse", "....");
    ...
}

Add the context provider to your template in the atlassian-plugin.xml

<content-template
    key="..."
    ...>
    ....
    <context-provider class="com.example.MyProvider" />
  </content-template>

Hope this helps.

Alex Yasurek
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 15, 2014

Yep that worked. I am able to get the values from the form and populate the title based on them. Thanks a lot.

Cris Kinross December 28, 2017

For the benefit of those of us who are learning, could we see an example of actual code? Let's say we want the blueprint page name to say "Business Notes" rather than "Meeting Notes." For simplicity, we won't need to add dates or other unique identifiers - just change the page name.

 

May we see an example? Thanks in advance - all help is appreciated.

TAGS
AUG Leaders

Atlassian Community Events