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

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.

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.

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted yesterday in Confluence

Calling all marketing teams who use Confluence - we want to hear from you!

Hi Community! me again 🙂 If you’re a marketing team using Confluence, we want to hear your story! How did you start using Confluence? What are your use cases? What have been some of the benefits?...

90 views 2 3
Join discussion

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