Dashboard > Atlassian Plugins > ... > Macros > add-page
  Atlassian Plugins Log In | Sign Up   View a printable version of the current page.  
  add-page

Added by David Peterson , last edited by David Peterson on Aug 10, 2007  (view change)
Labels: 

{add-page}

Plugin: Linking Plugin

This will create a link on your page which, when clicked, is equivalent to clicking 'Add Page' on the Page Operations bar.

Usage

{add-page:template=[template name]|live=true|parent=[@self,@parent,@home,Page Name]}[link text]{add-page}

Parameters

Name Required Default Description
template
The name of the Template to use when creating the page.
live
false
If set to 'true', the template will be 'live' - that is it uses the live-template macro to import and execute the current value of the template every time the page is viewed. Requires the Scaffolding Plugin to be installed.
parent
@self
The page you would like to be the parent of the new page. If no parent page is desired, set parent to a blank value. ie. 'parent='. There are also three special values:
  • @self - sets the parent to the new page the macro appears in.
  • @parent - sets the parent of the new page to the parent of the current page.
  • @home - sets the parent of the new page to the home page of the current space.
labels
The list of labels to attach to the new page. Only works for live template pages.
title
If you want popup text to appear when the mouse is hovered over the link, enter it here.
allowRename
false
(Since 2.4) If set to true, the user will be allowed to rename the page when it is being created.

Examples

I have a template which lets me fill in Project details. I want it to be used each time someone creates a new project
and listed automatically on the current page ('Projects').

h1. Projects
{children}
{add-page:template=Project Details|parent=@self}Add a Project{add-page}

Recipes

See Also

Is it possible to add a page to a different space?

Thanks, Ki

Yep - just put the space key in front of the page name for the 'parent' property. Eg:

{add-page:parent=OTHERSPACE:Parent Page}

Is there a way to do add-page so that it only works once.  I want to create a table of required documents, and the user can click once on each document to create a page using that document's template.  Once the page is created, its just a link where the create-page used to be.

You may want to try this:

create page macro, it worked for me.

Try link-page - just supply the page name. If the page doesn't exist, the first click will create it, if it does, it will just link to the existing page.

 can you have the add-page link open in a popup window? (combine link-page popup and add-page)

 Thanks, Ki

Hi Ki,

No such feature currently exists, but if you would like it to be added, please create a feature request - all work scheduled for future versions comes from there.

Hi CustomWare,

I'm enjoying the abilities Scaffolding + Reporting + live-template provide. However, add-page, the bow on the ribbon it make it easy for users, is failing for me. I have it set up with this simple tag:

{add-page:template=MeetingNotes|parent=@self|live=true|labels=meeting_notes}Add a page{add-page}

The link gets me to a page the allows me to enter a title and tells me it is using the template specified. However, when I click Save, I get the error message "You are not permitted to perform this operation" at the URL http://our_domain/pages/docreatefromboilerplate.action. This is in my personal space, where I am an administrator, as well as in another space on the wiki where I am also an administrator. Our site administrator, though, is able to complete the page creation process without issue.

Thanks! 

Our site administrator, however, is able to

There was a bug in an older version of the plugin which did this. What version of Confluence and the plugin are you currently using?

I was having the same problem after upgrading to Confluence 2.7. I discovered that the Plugin Repository couldn't identify the currently installed version of the Linking Plugin, so I had to uninstall it, and then I could install the latest. With 2.7 and Linking Plugin v. 2.5.0, the problem went away.

~Ryan

Yeah, that seems to be a bit of a bug with the plugin respository - if the installed version isn't listed as compatible with the current version of Confluence (due to an upgrade of Confluence usually), it won't automatically figure that out. Might be worth raising as a bug on the plugin repo...

The one critical missing feature here for me is the ability to specify a suggested title name for creating the new page.  Adding this feature should be trivial since you can easily just tack on "&title=NewTitle" to the end of the URL that this macro generates.  Ideally I would like to be able to have the macro string generate a date string, e.g.

{add-page:desttitle=My Meeting Notes for date:yyyy-MM-dd%}Add New Meeting Notes...{add-page}

But I would still be very happy just being able to do:

{add-page:desttitle=My Meeting Notes for 20XX-XX-XX}Add New Meeting Notes...{add-page}

and having it always be manual.

You can actually already do this, although typically you would use the link-page macro instead. It would look like this:

{link-page:name=My Meeting Notes for %global:current date > yyyy-MM-dd%}Meeting notes for %global:current date > dd MMM, yyyy%{link-page}

This will create either a 'create page' link if the meeting notes for the current date don't yet exist, or a link to the existing notes.

Unfortunately that doesn't work because the link-page macro does not allow you to rename the page on the edit screen.  As far as I can tell there is no macro that exists that allows you to configure it to both suggest a name *and* allow the user to change the name before the page gets created.  That's why I was looking to the add-page macro.

Just add the 'allowRename=true' parameter as documented above.

 I was combing through the documentation for an hour yesterday and don't know how I missed that.  Thanks!

is there a way to have the macro define a prefix and suffix like create-page. I would like the user to put in a number and the macro to put in the rest?

Currently it can't do that. It's a good idea though - could you create a feature request for it so it will get looked at for the next version?

I'm having problems with confluence 2.9 and the macro ... 

It appears that I can't use a global template.  I get the following error:

 The boilerplate {0} does not exist, or is inaccessable.

 live-template is able to use the global template however.   Any suggestions?

Hi Ki,

I'm having the same problem. Were you able tu solve this problem?

Hi Veronica,

I was able to recompile the linking plugin and I replaced the getBoilerPlate() method with this:

     private PageTemplate getBoilerplateTemplate() {
        if ( TextUtils.stringSet( boilerplate ) ) {
            PageTemplate spaceTemplate = pageTemplateManager.getPageTemplate( boilerplate, getSpace() );
            if (spaceTemplate == null) {
                return pageTemplateManager.getPageTemplate( boilerplate, null);
            } else return spaceTemplate;
            
        }
        return null;
    }

It works great for me now.

Hi,
Is it possible to customise the 'Add Page' screen that comes up when a new live template page is created? If not can I skip this page completely?

Hi Joel,

Short of applying a custom theme to your Confluence, you won't be able to customise the "Add Page" screen which comes up when you create a new page using this macro. If you want to skip this page completely you could consider using the add-page-form macro instead.

Regards,
Jonathan.

Copyright(c) CustomWare Asia Pacific Pty Ltd
Powered by Atlassian Confluence 2.7.3, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators