Split page titles containing hyphens into separate values

Split page titles containing hyphens into separate values

Scenario

This recipe shows you how to split page titles containing hyphens into separate values and use them in separate columns of a table. 

For example, you have many pages with titles of the following format:

<Meeting-ID> - <Meeting-Title>

For example:

  • 12345 - Meeting with NASA

  • 23456 - Meeting with Dolby

  • 34567 - Meeting with Atlassian

With the Collection Supplier and the Text Supplier, you can split the page titles with hyphens to break the Meeting ID and Meeting title into two different columns. 

Result

Recipe

Apps

Reporting for Confluence Data Center

Level

Easy

Estimated time

10 minutes

Macros

Content Reporter, Report Column, Report Info, Report Table, Text Sort

Suppliers

Collection Supplier, Content Supplier, Date Supplier, Text Supplier, User Supplier

Storage format

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

<ac:structured-macro ac:macro-id="84217c92-e5d7-4cc7-93da-17ca44bdff03" ac:name="report-table" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="b097ce96-aeb0-475b-b3ba-6ee46166a4c5" ac:name="content-reporter" ac:schema-version="1"> <ac:parameter ac:name="types">page</ac:parameter> <ac:parameter ac:name="scope">Meeting Notes &gt; Children</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="4ce3d743-c0ef-4a66-a4c5-27ff4e0fec81" ac:name="text-sort" ac:schema-version="1"> <ac:parameter ac:name="">title</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="0cf0354e-ac50-4a76-be26-e36beb9dc7b1" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Meeting ID</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="4e836aa8-bf1a-48c8-a17c-940f0f4abb76" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">content:title &gt; text:split with - &gt; collection:1</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="9e28024b-5e39-4503-baa6-f7b3c2e3264f" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Meeting Title</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="ae0a35a2-9633-40ba-8e3f-d203c1ee38b1" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="link">true</ac:parameter> <ac:parameter ac:name="">content:title &gt; text:split with - &gt; collection:2</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="814e3d66-e6fa-4249-98a7-5ada0e2d8c42" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Created Date</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="7a3dc562-4c60-409a-8f88-4333e74347a6" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">content:creation date &gt; yyyy-MM-dd</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="94d6cb4e-1ab1-4f03-8c25-b8d884cbcf4d" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Creator</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="3fb0ed4d-62b5-4a13-8b85-e2c5928a80a9" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">content:creator &gt; full name</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <p class="auto-cursor-target"> <br /> </p>

Macro structure

You can recreate the example in the editor view:

Steps

  1. Create a Report Table macro.

  2. Within the Report Table macro, create a Content Reporter macro with the following parameters:

    • Types: page

    • Scope: Meeting Notes > Children

  3. Within the Content Reporter macro, create a Text Sort macro with Key: title.

  4. Under the Content Reporter macro, create four Report Column macros nested with Report Info macros with the following parameters:

Report Column macro parameters

Nested Report Info macro parameters

Report Column macro parameters

Nested Report Info macro parameters

Title: Meeting ID

Key: content:title > text:split with - > collection:1

Title: Meeting Title

  • Key: content:title > text:split with - > collection:2

  • Link To Item: selected

Title: Created Date

Key: content:creation date > yyyy-MM-dd

Title: Creator

Key: content:creator > full name