Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Live template
templateUse Case LiveTemplate
typetemplate

...

Scenario

You might want to guide users in creating content in Confluence by providing a one-click link to create a page with a structured layout:

  • Automatically use a Confluence template as the base structure.

  • Automatically suggest a page title

  • Automatically categorize a page under a parent page

  • Automatically add labels to the page

You may also apply this to Scaffolding Live Templates. See Using Links to Create Pages from Live Templates. (Only applicable for the Server version.)

Result

...

Recipe

Apps

Linking for Confluence Server

Platform

Server and Data Center

Level

Easy

Estimated time

5 minutes

Macros

Add Page

Suppliers

N/A

Storage format

You can copy and paste this code into the Confluence Source Editor:

Code Block
<h3>Product Catalogues</h3>
<hr/>
<p>
  <ac:structured-macro ac:macro-id="3417a97b-c0d4-4f1d-8d86-b45231cb688d" ac:name="add-page" ac:schema-version="1">
    <ac:parameter ac:name="parent">Products</ac:parameter>
    <ac:parameter ac:name="prefix">Product - </ac:parameter>
    <ac:parameter ac:name="linkText">Create a new Product</ac:parameter>
    <ac:parameter ac:name="source">Product template</ac:parameter>
    <ac:parameter ac:name="labels">product</ac:parameter>
  </ac:structured-macro>
</p>
<p>
  <ac:structured-macro ac:macro-id="7b7af786-9714-436e-bf32-d00ee45e2176" ac:name="add-page" ac:schema-version="1">
    <ac:parameter ac:name="parent">Product Suppliers</ac:parameter>
    <ac:parameter ac:name="prefix">Product Supplier - </ac:parameter>
    <ac:parameter ac:name="linkText">Create a new Product Supplier</ac:parameter>
    <ac:parameter ac:name="source">Product supplier template</ac:parameter>
    <ac:parameter ac:name="labels">product-suppliers</ac:parameter>
  </ac:structured-macro>
</p>
<p>
  <ac:structured-macro ac:macro-id="1fad6390-a12d-4833-b63e-2f1447f2cd55" ac:name="add-page" ac:schema-version="1">
    <ac:parameter ac:name="parent">Contracts</ac:parameter>
    <ac:parameter ac:name="linkText">Create a new Contract</ac:parameter>
    <ac:parameter ac:name="source">Contract template</ac:parameter>
    <ac:parameter ac:name="labels">contract</ac:parameter>
  </ac:structured-macro>
</p>

 

Macrostructure

You can recreate the example in the editor view:

...

Steps

  1. Create an Add Page macro.

  2. For the parameter Create Link Text, enter the link title, e.g., "Create a new Product".

  3. To decide what will happen when a user clicks on the link, specify the source parameters:

    1. Source parameter determines the name of the Confluence template to use. E.g., "Product template".

    2. Source type is set to "template" since it is based on a Confluence template.

  4. Expand the Configure page title prefix/postfix and use Prefix and Postfix parameters. In this example, we add "Product - " as a postfix, so all page titles will start with "Product - (Name of Product)".

  5. To ensure organized space, use the Parent parameter, which tells Linking where to create the page. Useful to automatically categorize the pages.

  6. You can also automatically add label(s) to the pages. For this example, we specify "product" in the Labels parameter.