Create page from blueprint with todays date

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

This widget could not be displayed.

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.

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

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.

This widget could not be displayed.

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

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.

This widget could not be displayed.

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

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Tuesday in Confluence

Add-on evaluation with confluence templates

Atlassian market place contains number of Apps/Addons which improves the capability of out of the box Atlassian products. It is good to follow a plugin evaluation process before install add-ons. So t...

108 views 12 6
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you