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

Create page from blueprint with todays date

Robert Obuch September 2, 2014

Using Confluence OnDemand as an administrator, I want to create a blueprint that inserts the date when a page is created.

This functionality already exists on some out-the-box blueprints.

Is this possible?

3 answers

1 vote
Yagnesh Bhat
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.
September 8, 2014

You will have to write code for this blueprint - firstly create a soy template , use the following configuration to setup the title of the page:

<input id="topic-title" class="text  long-field" type="text" name="title" title="title"
                   placeholder="{getText('some.placeholder')}" maxlength="255">

 

Now with that done, you will have to append the current date with the necessary format  to the input id above, in the postRender method of the blueprint (Refer : https://developer.atlassian.com/display/CONFDEV/Javascript+API+for+blueprint+wizards for more details.

 

Ok, so that will take care of setting the title of the page.

 

Now to add the date in the page body, you will have to write a user macro (either in Java or Velocity) that returns the date, then use it in the template used by the blueprint you created above, that way, it will render the date wherever the macro is put in the template. Please refer to the confluence guides for creating macros for more on this.

 

So to sum up, you would need a new blueprint and a macro to achieve this.

Robert Obuch September 8, 2014

Thanks for your response! Will this be possible using Confluence OnDemand?

Yagnesh Bhat
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.
September 8, 2014

It probably should be , as all we are doing is creating a macro and a blueprint using the standard documented procedures. I am not very familiar with Confluence OnDemand but cant think of a reason why this shouldnt work as its all standard javascript and java/velocity.

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.
June 11, 2016

Hi,

For those who do not want to get into the Java programming. Try our Page Tree Creator Add-on.

Our Add-on Page Tree Creator works a bit different than the Confluence blueprints / templates. The PTC-templates are based on normal confluence pages and therefore creating a PTC-template is as simple as creating a Confluence page. Of course you could start creating your PTC-blueprint based on an existing Confluence page.

Try our Live Examples (no registration needed).

Marketplace link: Page Tree Creator.

Regards,
Stephan

0 votes
Yagnesh Bhat
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.
September 2, 2014

Where do you want the date to be inserted? In the page title or the page body? Can you give an example?

Robert Obuch September 8, 2014

Ideally, both. For example, I create a page using a blueprint and the title of the page by default is 'Page title - 9 Sept 2014'. The same content (date) would be also be available in the body.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events