Use a link for creating pages with incremental IDs
Scenario
Linking can add identifiers to your page titles. With this, you can name your catalog pages or series of assets, projects, components, ideas, or configuration pages with an ID as a prefix or postfix.
Using the Child Counter Supplier, you can use the number of children pages as an ID.
Result
Recipe
Apps |
Linking for Confluence
|
|---|---|
Platform | Server and Data Center |
Level | Intermediate |
Estimated time | 10 minutes |
Macros | Add Page |
Suppliers | Child Counter Supplier |
Storage format
You can copy and paste this code into the Confluence Source Editor:
<h2>Assets</h2>
<hr/>
<p>
<ac:structured-macro ac:macro-id="77455a8b-7630-4234-a312-4cbb39c4e516" ac:name="children" ac:schema-version="2">
<ac:parameter ac:name="sort">title</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="45601cb2-e628-4967-8e21-941f97cdeff8" ac:name="add-page" ac:schema-version="1">
<ac:parameter ac:name="prefix">Asset #%child-counter:next > number:000% - </ac:parameter>
<ac:parameter ac:name="linkText">Document new Asset</ac:parameter>
</ac:structured-macro>
</p>
Macro structure
You can recreate the example in the editor view:
Steps
Add an Add Page macro.
Add a title for the Create link text field, for example,
Document new Asset.Since we want to automatically add an ID at the beginning of the pages, enter the following value for the Prefix parameter:
Asset #%child-counter:next > number:000% -This means the following:
Every page title will have the Asset # text at the beginning.
They are followed by the number of children on the page (as an ID). Here, we use an injection notation with a key from the Child Counter Supplier. The notation
number:000defines the format of the number, for example, 001, 002, and so on.When clicked, users will be prompted to complete the title of the page, for example, Asset #054 - Laptop.
Add a Children Display macro to display the children pages created by the Add Page macro.
If you want to alter or reset the counter provided by the Child Counter Supplier. For details, see Child Counter Status.