Adding a Template

A template is a predefined page that can be used as a framework when creating new pages. Templates are useful for setting a common style or format for a page.

In Confluence, there are two places to store your page templates:

  • Space templates: These page templates are available in a specific space only. People who have space administrator permission can define templates via the space administration screen.
  • Global templates: These page templates are available in every space on the site. People who have Confluence Administrator permission can define the global templates via the Confluence Administration Console.

Adding a space template

Space templates are available in one space only.

To add a template for a space:

  1. Go to the space and choose Space tools > Content Tools on the sidebar. 
  2. Choose Templates Create new template.

If your space uses the Documentation theme:

  1. Choose Browse > Space Admin at the top of the screen.Note: The 'Space Admin' option appears only if you have space admin permissions for the space or you have System Administrator global permissions.
  2. Choose Templates from the space administration options.
  3. Choose Create new template.

The 'Create Template' screen will appear. Add content as described below.

Adding a global template

Global templates are available in all spaces in your Confluence site.

To add a global template:

  1. Choose the cog icon , then choose General Configuration under Confluence Administration.
  2. Choose Global Templates and Blueprints in the left-hand panel.
  3. Choose Add New Global Template.

The 'Create Template' screen will appear. Add content as described below.

Using the template editor

This illustration shows the template editor with an image, some text, styling, and variables.

The resulting form when the template contains variables

This screenshot shows the form displayed when someone creates a page based on the template containing the above variables. (See Creating a Page using a Template.)

Adding content to your template

Add a name for your template.

Enter text into the body of the template, and use the editor toolbar to apply styles, layout and formatting. You can add links and macros. In general, you can use the Confluence editor in the same way as on a page. In addition, you can add variables which will produce a form for data collection when someone adds a page based on the template.

Below are some points of special interest in templates.

Labels

Choose Labels to add one or more labels to the template. These labels will be included in all pages created using this template.

Images and other attachments

You can't attach an image or other file to a template. Instead, attach the file to another page, and insert it into the body of the template.

For example:

  • You can attach an image to a page and then choose InsertImage to embed the image into the template.
  • You can attach a PDF to a page and then choose InsertOther MacrosPDF to embed the PDF into the template.

Variables used as form fields

You can add variables to your template, to act as form fields. When someone creates a page based on the template, Confluence will display a text entry box for each field. The user can enter data into each field, and the data is inserted onto the new page.

Every variable must have a unique name. If you add the same variable more than once in the same template, Confluence will make sure that they have the same value when the user saves the page. This is useful if you need the same information in more than one place in the page.

To insert a variable into a template:

  1. Place your cursor on the template where you want the variable to appear.
  2. Choose Template > New Variable from the editor toolbar. Alternatively, you can choose the name of an existing variable if you want the same variable to appear more than once in the template.
  3. Enter the variable name.
  4. Press Enter. By default this will create a single-line text input field.
  5. To change the variable type, click the variable placeholder. The variable's property panel will appear. Choose one of the variable types: TextMulti-line Text, or List. See below for a description of each type.

Speeding up variable entry with autocomplete: Type $ and the variable name, then press Enter, to add a new variable or to select an existing variable from a list of suggestions. The suggestions are drawn from variables already defined in this template.

These are the types of variable available:

Variable type Description

Text

Creates a single-line text input field.

Screenshot: A template variable called $purpose and its property panel

Multi-line text

Creates a text box that allows more than one line of text.

By default, the text area is 5 rows depth and 100 characters wide. You can change the size by typing over the digits in the variable property panel.

Screenshot: A multi-line variable and its property panel

List

Creates a dropdown list.

You must specify the values that will appear in the dropdown list. The values:

  • Must be separated by commas.
  • Can include letters, numbers, special characters, and spaces.
  • Cannot include commas (except as the list separation character).

Screenshot: A list variable and its property panel


Instructional text

Instructional text allows you to add placeholder content to a template.  This text is only visible in the editor and disappears when the author of the page begins typing.

To insert instructional text into a template:

  1. Place your cursor on the template where you want the instructional text to appear.
  2. Choose Template > Instructional Text on the editor toolbar.
  3. Begin typing - the instructional text appears in italics with a shaded background to distinguish it from normal paragraph text.

You can also change the placeholder type from 'text' to other types, including some that trigger an action such as a user mention or creating a JIRA issue.

The following instructional text types are available:

Instructional text type Description
Text

Creates a line of text that is only visible in the editor. Instructional text disappears when the user begins typing.

User Mention

Creates a line of text that is only visible in the editor. When clicked it triggers the @mentions dialog.

JIRA Issue

Creates a single link of text that is only visible in the editor. When clicked it triggers the JIRA Issues macro dialog. Users can then search for or create a new issue.


Adding a description to your template

The template description displays in the 'Create' dialog and is useful for explaining the purpose of a template to users.

To add a description to a template:

  • Go to the space or global templates page (as described above).
  • Choose the Edit icon in the 'Description' column.
  • Enter your description and save. 

Converting an existing page to a template

If you would like to convert an existing page to a template, you can copy the content from the page and paste it into the template editor. There is no automated way of doing this.

Please note the section above about images and other attachments in templates.

Notes

  • You cannot insert variables via the 'Insert wiki markup' option in the editor toolbar.
  • Page templates are used only when adding a page. It is not possible to apply a template to an already-existing page. Once a page has been added using a template, the template is no longer linked to the page. All further editing is performed as if the template was never used. Some plugins provide enhanced template functionality. You can search the Atlassian Marketplace for template add-ons.
  • When you use a Table of Contents macro in a template, you will see an error when you preview the template itself. But the Table of Contents macro works on the pages that people create from the template – the table of contents shows up after they have saved the page. (This is probably because the template is not defined as a page, and the Table of Contents macro works for pages only.)
  • The editor for templates is available only in Confluence 4.3 and later. Please refer to the earlier documentation for a description of the wiki markup editor templates.
  • Confluence also provides 'system templates' containing content like the site welcome message and default space content. See Administering Site Templates.

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport