Skip to end of metadata
Go to start of metadata

Overview

The {create-page} macro asks the user for the name of the page and then creates it based on a template…
The macro creates a link which, when clicked, asks the user for the title of the new page:


The new page is then created, based on the template specified, completely bypassing the usual "Add page" screen.
This is especially useful when working with Scaffold Templates because the user is taken directly to the editable view of the page – they can immediately fill in the fields provided by the template.

Parameters:

The parameters for create-link are as shown below:

{create-page:space=myspace|parent=pagename|fallback=fallbackspace:fallbackpage|title=pagetitle|labels=pagelabels|prefix=before|postfix=after|
addspace=false|target=view|template=mytemplate|boilerplate=myboilerplate|prompt=Please enter the new page name}link text{create-page}

 

 

Parameter

Required

Default

Notes

space

 

current space

By default, the new page will be created in the current space unless you specify an alternative space with this parameter.

When specifying a value for this parameter you are saying that the new page will be created as a child of the home page of the space.

parent

 

@self

By default, the created page will use the current page as it's parent. However, you can specify a parent page as follows:

  • @self – the default setting which will create pages as children of the page containing the macro
  • @parent – will create new pages that are siblings to the page which contins the macro (ie: will have the same parent as the current page)
  • @username – uses the username of the user that created the page as the parent
  • @fullname – uses the full name of the user that created the page as the parent
  • @year – add the current year as the parent
  • @month – add the current month as the parent
  • @day – add the current day as the parent
  • page title – the new pages will be attached to the page whose title matches the one supplied

Please note that this parameter will not be taken into account if you have already specified a value for the space parameter.

You can either use the space or the parent but not both of them at the same time.

fallback  This allows the user to specify a space and page to fallback to in case the page specified using the parent parameter cannot be found. It should be used in the format: space:page
title  

Specify the title of the new page. This is most useful when injecting values into the new pages title, the following can be used:

  • %parenttitle% - the title of the parent page
  • %ident% - an integer which increases each time a new page is created
  • %username% – uses the username of the user that created the page as the title of the new page
  • %fullname% – uses the full name of the user that created the page as the title of the new page
  • %year% – uses the current year as the title of the page
  • %month% – uses the current month as the title of the page
  • %day% – uses the current day as the title of the page
labels  

Add labels to the new page. Accepts several labels in a comma separated list, also white spaces will act as separators. Illegal characters ( , !, #, &, (, ), *, ,, ., :, ;, <, >, ?, @, ,, ^) will be removed.
The following injected values can be used:

  • %parenttitle% - the title of the parent page
  • %pagetitle% - the title of the new created page
  • %username% – uses the username of the user as a new label
  • %fullname% – uses the full name of the user as a new label
  • %year% – uses the current year as a new label
  • %month% – uses the current month as a new label
  • %day% – uses the current day as a new label

prefix

 

 

A prefix to be applied to the page title given by the user.

postfix

 

 

The suffix to be applied to the name given by the user.

addspace

 

true

By default, spaces are inserted between the user specified page title and any pre-defined prefix or postfix unless you set this parameter to false.

target

 

Defaults to view mode

Options are 'view' or 'edit'. Whether to go to view or edit mode.

template

 

 

The name of the template whose contents will be copied to the new page.

boilerplate 

 

 

The name to be used in the boilerplate macro injected into the new page.

addimg truedisplay + icon to side of link

prompt

 

'Please enter the new page name'

This parameter allows you to customise the prompt shown to the user when adding the new page.

Recipes

Basic Use

To create a blank page attached to the current page, but named by the use at runtime:

{create-page}Click here to create a page{create-page}

 

Which looks something like this if the user has the required privileges to create a page:


And if the user does not have sufficient privileges to create the page, they will see this:

From Create Page version 3.2.9 onwards the user can add a Button to create a page, by checking the "Display Button" parameter.

Setting the parent page

You do not necessarily need to use the current page as the parent page to the link, you can also use the @parent macro parameter which will use the current page's parent to contain the newly generated pages:

{create-page:parent=@parent}Click Here{create-page}

 

Alternatively you can specify any page within the current space using it's title:

{create-page:parent=My Parent Page}Click Here{create-page}


Using the space parameter in combination with the parent you may specify any page in any space as the parent page:

{create-page:parent=My Parent Page|space=MYSPACE}Click Here{create-page}

 

Setting labels for the new page

There is the possibility of adding one or several labels to the labels parameter. Each label could be separated by a comma or a white space:

 

{create-page:labels=newlabel1,newlabel2}Click here to create a page with labels{create-page}

Will create a page with two labels: newlabel1 and newlabel2 

 

Also the labels parameter accepts the injected values %parenttitle% and %pagetitle%:

 

{create-page:title=New Page|parent=Parent Page|labels=%parenttitle%,%pagetitle%}Click here to create a page with labels{create-page}

Will create a page with the following labels: ParentPage and New.

 

Defaulting the contents of the new page

The {create-page} macro becomes very powerful when used in conjunction with confluence templates or scaffolding boilerplates, since it allows you to create a simple link that can be clicked to create a page within a specific location, using a specific template or boilerplate.

In fact the original purpose behind create-page was to enable creation of pages that contain boilerplates which point to templates that contain scaffolds.

When the boilerplate parameter is used, the page that is generated will contain a {boilerplate:whatever} macro which will dynamically include the given template page. Meaning that if you update the template then the pages that use the template are also updated. This is at it's most useful when the template being included contains a scaffold that contains the data to be displayed to the browsing user.

{create-page:boilerplate=my template}Click Here{create-page}

Alternatively you may wish to simply copy the contents of a template to the newly created page and then edit the contents in the normal way. This can be achieved using the template parameter.

{create-page:template=my template}Click Here{create-page}

 

Using naming conventions

It is possible that you may wish to formalise the names that are generated by the {create-page} macro, this may be achieved by using the prefix and postfix parameters to surround the name given by the user with something that helps to categorise the page. For example:

{create-page:prefix=User Submission}Click Here{create-page}

Will create pages which are prefixed by the text 'User Submission: ' to denote that they have been created by a user interacting with your page.

Alternatively you may add a suffix or 'postfix' to the page name given by the user:

 {create-page:postfix= (Project Brief)}Click Here{create-page}

Which will add ' (Project Brief)' to the end of the name given by the user.

Future versions of this plugin may add features that will allow you to use tokens in the prefix and suffix which will allow you to insert the current date/time into the page name, or the name of the user that created the page. Donations welcome.

There may be times when you wish the prefix/postfix to be attached directly to the name given by the user, such that there is no space between it and the pre/post-fix.

By setting the addspace parameter to 'false' the spaces are removed:

 {create-page:postfix=.user|addspace=false}Click Here{create-page}

Will result in pages named like 'my page.user' and 'test.user'

Setting the text of the request for the page name

The name that the user gives in response to the prompt can be heavily influenced by the phrasing of the question that requests it. A user will most likely feel more comfortable when entering the name of a new project when confronted with a prompt that states 'Please enter the name of the new project' rather than the default 'Please enter the new page name'.

You can set the prompt text using the 'prompt' parameter:

 {create-page:prompt=Incorpore por favor el nuevo nombre de la página}Chasque Aquí{create-page}

Plugin Support

Issues and User Questions have been archived in our read-only forums:

Known Issues

User Questions

Suggested Improvements

 

Top of page

  • No labels