Write a simple Confluence Space Blueprint
This tutorial applies to Confluence 5.3 and higher.
Level of experience:
It should take you less than 1 hour to complete this tutorial.
Overview of the tutorial
This tutorial shows you how to create a very simple space blueprint plugin. This tutorial does not require writing any Java classes. To complete this tutorial, you should have installed the Atlassian SDK and worked through the Atlassian Plugin SDK tutorial. It will also help to have completed the Write a simple Confluence Blueprint plugin tutorial.
On this page:
Step 1. Add your space blueprint definition
In this step you will define your space blueprint and have a simple create space dialog wizard.
src/main/resources/atlassian-plugin.xml file, and create the web-item for the create space dialog, add the following:
Add the space blueprint definition and a wizard with one page. Note that the category is an optional attribute which essentially adds a label to all spaces created via this blueprint. This will show an "Examples" category listed in the space directory with all the spaces created with our example space blueprint.
Step 2. Add your space dialog wizard
Update the web-resources to include the
dialog-page.soy for your wizard form (note we will need the transformers
soyTransformer and jsI18n). Also add some contexts to ensure your resources are included on every page.
soy folder for your dialog wizard template under
src/main/resources (or use your IDE):
In that folder, create a file called
dialog-page.soy. This calls a generic space form (with space key and name fields) already available for you.
src/main/resources/js/spacebp.js file and hook into the wizard apis. They are similar to the blueprint ones. In our example here, we update the space home page title to be the space name and a suffix of " Home Page".
Add the i18n strings to
Step 3. Create a home page for your space blueprint
Space blueprints let you define a custom homepage template to use when creating the space.
xmlfolder for your homepage template
Create a new file called
example-space-home.xmlin that folder that includes the children macro:
Add the content template to the
Add the content template reference to the space blueprint definition:
Add the new keys to the i18n properties file:
Step 4. Run your plugin
At this point, you have created a skeleton space blueprint plugin.
- Use the atlas-run command to start a local Confluence instance.
Run the following command:
- Log into the instance as user
adminusing a password of
Click Create Space and then select your space blueprint. It should take you through a wizard with a basic space form to create a space and see your home page with a child a children macro pre populated.
Step 5. Add new fields to the create space dialog
During the creation of your new space, you might want to ask the user for some information in the create dialog. In our example here, we will add a space description field. We will also add a custom heading field to display it on the space homepage.