Templates

We have been adding a lot of pages by now and every time we started from scratch; but we don't have to. When you find yourself creating the same page structure over again, or you want your users to use the same structure for reasons of consistency, templates are the answer.

Templates are predefined pages that can be used as a scaffold when you are creating pages. Only new pages can be created from a template, and when a template is used the new page will contain the same content as the template. Templates are very useful when you want a uniform style or format for your pages.

Using templates

When there are templates available, you can start using them to create new pages. When you create a page based on a template, Confluence will copy the following content and information to the new page:

  • Labels
  • Text and styles
  • Layouts and other formatting
  • Macros
  • Displayed media such as images or videos

The newly created page is not connected in any way to the original template; changes made to the template will not reflect on the created page. It is not possible to apply a template to an existing page; templates can only be used when creating a new page. The newly created page can be edited in any way a blank page can; content can be added, updated, and removed.

To create a page based on a template, perform the following steps:

  1. Click on Create in the header.
  2. Select a space to create the new page in.
  3. Choose a template from the available templates.
  4. If the template contains variables, you will see a form. Type the relevant information into the fields and click on Next.
  5. You will see a new page based upon the template.
  6. Give the page a title and add, update, or delete the content.
  7. Click on Save.

The following screenshot displays the available templates that can be used to create a new page:

Using templates

Creating templates

In Confluence, templates can be created on two levels of the Confluence hierarchy:

  • Space templates: These templates are only available in the space you created them in. Space Administrators can define space templates via the space admin screen.
  • Global templates: These templates are available in every space in Confluence. Confluence Administrators can define global templates via the Administration Console.

Space templates

Space templates can be created by Space Administrators and are only available in the space you create them in.

To add a template for a space, perform the following steps:

  1. Go to any page in the space.
  2. Click on Space Tools from the sidebar.
  3. Select Content Tools, followed by Templates from the space admin menu.
  4. Click on the Create new Template button.

If your space uses the documentation theme:

  1. Select Browse | Space Admin.
  2. Click on Templates from the left-hand navigation.
  3. Click on the Create new Template button.

You will be redirected to the Create Template screen. How you can add content and create your template is explained in the Adding content to your template section.

Global templates

Global templates can be created by Confluence Administrators and are available in all spaces within Confluence.

To add a global template, perform the following steps:

  1. Browse to the Administration Console (Administration | Confluence Admin).
  2. Choose Global Templates in the left-hand side menu.
  3. Click on the Add New Global Template button.

You will be redirected to the Create Template screen. How you can add content and create your template is explained in the Adding content to your template section.

Adding content to your template

The Create Template view is very similar to the regular editor in Confluence:

Adding content to your template

What normally is the page title will now be the template name. The template name will be displayed when you create a new page, so choose a descriptive name for your template.

The content of the template is just like a regular page; you can use styles, layouts, and other formatting. You can also add links and macros. In addition to the normal features, the template editor also allows you to add variables and instruction texts. Using variables in your template will create a form for collection of data when someone adds a page based on the template.

Some points to take into account when creating a template are:

  • Labels: Select Labels from the bottom-left to add labels to the template. These labels will be included in all the pages created using this template.
  • Images and other attachments: It is not possible to add any file or image to a template. If you want to use an image or attachment in your template, you need to attach this file to another page in Confluence.

    Then insert the image by performing the following steps:

    1. Select Insert | Image.
    2. Use the media browser to find your image.
    3. Click on Insert to insert your image.
  • Instructional text: Instructional text allows you to add placeholder content to a template. This placeholder is only visible in the editor and disappears when the author of the page begins typing in that placeholder.

    These texts can provide instructions for users on how to use the template and which data is expected at certain locations.

    To insert an instructional text, perform the following steps:

    1. Place your cursor on the template where you want the instructional text to appear.
    2. Click on Template on the editor toolbar.
    3. Select Instructional Text.
    4. Start typing; the instructional text appears in italics with a shaded background to distinguish it from the normal paragraph text.

    The type of the placeholder can be changed from "text" to a "user mention", which starts the mention's autocomplete when the author starts typing. To change the placeholder type, click on the placeholder and select User Mention.

  • Variables: With variables you can introduce data entry to your template, making sure not only the layout is organized but the content as well. Variables added to a template act as form fields. When somebody creates a page based on your template, Confluence will display an entry box for each variable as shown in the following screenshot. Users can enter data into each field and the data is then inserted onto the new page:
    Adding content to your template

    Each variable must have a unique name. If you add the same variable more than once in the same template, Confluence will provide both placeholders with the same value. This is useful when you need the same information in more than one position.

    To insert a variable into a template, perform the following steps:

    1. Place your cursor at the location you want to insert a variable
    2. Select Template from the editor toolbar.
    3. Select an existing variable or click on New Variable.
    4. Enter the variable name.
    5. Press Enter. This will create a single-line text input field.
    6. To change the variable type, click on the placeholder. The property panel will appear where you can choose different types. See the next table for a description of those types.

Speed up variable entry by using the keyboard shortcut $ (Shift + 4) for autocomplete.

These are the types of variables available:

Variable type

Description

Text

Creates a single-line text input field as shown:

Adding content to your template

Multi-line text

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

By default, this textbox is of 5 rows with 100 characters wide. You can change the size in the property panel:

Adding content to your template

List

Creates a drop-down list. You must specify the values for the drop-down list. These values:

  • Must be separated by commas
  • Can include any letter, number, spaces, and other special characters except a comma, as these are used as separators
Adding content to your template

Importing templates

In addition to creating your own templates, you can download predefined templates from the Atlassian Marketplace in the form of a template bundle or Blueprints. Each bundle contains one or more templates, created by Atlassian or other parties.

An example of one of those bundles is available here:

https://marketplace.atlassian.com/20489

Downloading and installing add-ons, like template bundles, is described in more detail in Chapter 9, General Administration.

Checking installed template bundles

To check which bundles are available and can be imported, perform the following steps:

  1. Browse to the Administration Console (Administration | Confluence Admin).
  2. Select Import Templates from the left-hand side menu.
  3. You will see a list of template bundles installed and all the templates included in each bundle:
    Checking installed template bundles

    Display of template bundles available for import

Making templates available for usage

If you have one or more template bundles installed, you can import them to make those templates available for your users.

To import a template, perform the following steps:

  1. Browse to the Administration Console (Administration | Confluence Admin).
  2. Select Import Templates from the left-hand side menu.
  3. You will see a list of template bundles installed and all the templates included in each bundle. If you click on the template name, a preview is shown.
  4. Select the templates you want to import by checking the boxes next to the template names.
  5. Choose the destination for the templates in the Import To: dropdown. If you want to import the templates to a specific space, select that space; otherwise select Global Templates to make the templates available for all spaces.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.246.245