Automatically create/add a page

Hi,

I have several templates to make it easier for users to add stuctured content.

I want to also add unstructured content to the created pages, but wish to do this by automatically creating/adding a child page to the one renderd through the template.

USE CASE:

A user clicks a link that takes him/her to a template form; this will create a new page in that space. (done this bit).

So, when finished, the user clicks 'Save' and the form creates a new page. IN ADDITION, a child page is created (based upon that parent page name) and is imbedded inside the parent page (using the Include Page Macro {include:...}).

WHY?

In doing this, I can have a repository of structured data which can be efficiently presented, searched etc, AND a running notes/test area on the page which can be manipulated by users on the fly. This way, I get a really rich and rapidly grown repository for my userbase.

1 answer

Cracked it (well, in fact Mick Roff did!!! This solution includes his text. Thanks Mick!)

Firstly, put the create childs in a report to minimise when the report is run. This is set it up only to run within the first 60 seconds of the parent page being created. This ensures child pages that have been spawned can be deleted if required. If you don’t have this restriction, then the child pages will continue to be spawned if they are not present.

Then, the use of the replace and render function allows you to replace %title% with the name of the parent page.

Finally, add a {create-child} macro (in a {replace} macro) to add a child page of the correct title.

Should look like:

{report-block}
{local-reporter:content:creation date}
{date-filter:creation date|afterValue=-60s|format=hh:mm:ss dd MMM, yyyy}
{local-reporter}
{report-body}
{replace-and-render} {replace-body}
{create-child:%title% - Notes|parent=@self|template=Notes Page}
   {create-child:Grandchild Page -%title%|parent=Child Page -%title%|template=Blank }
{replace-body} {replace-item:%title%} {report-info:report:root content > page:title}{replace-item} {replace-and-render}
{report-body}
{report-block}

And:

{replace-and-render} {replace-body}
{create-child:Child Page -%title%|parent=@self|template=Blank }
   {create-child:Grandchild %title% - Notes|parent=Child Page -%title%| }
{replace-body} {replace-item:%title%} {report-info:report:root content > page:title}{replace-item} {replace-and-render}

The next thing I have to work out is how to automatically pre-fill the notes page (either with a template or without) in order that It renders content as soon as the main page template is saved. At the moment, it shows the pink 'macro error' lines of text where the child pages should render, which is not fixed until they are opened, edited and saved (which completes the parent page).

Any answers to that last piece of the jigsaw?

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 9 hours ago 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?...

41 views 1 2
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