List pages created from specified global templates

List pages created from specified global templates

Scenario

This recipe generates a list of pages that are created from specified global templates. To display the list of pages using a particular global template, you must provide the name of the template in the report.

Result

Recipe

Apps

Reporting for Confluence Data Center, Linking for Confluence Data Center

Level

Choose one: Easy / Intermediate / Advanced

Estimated time

10 minutes

Macros

And Filter, Content Reporter, Or Filter, Report Column, Report Info, Report Table, Text Filter, Text Sort

Suppliers

Body Supplier, Collection Supplier, Content Supplier, Page Supplier, Text Supplier

Storage format

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

<p> <span style="font-size: 16.0px;font-weight: bold;letter-spacing: -0.006em;">Find pages that are created from Global Templates&#xa0;</span> </p> <ac:structured-macro ac:macro-id="e1c4cdb4-751f-468a-8d72-c48088e463ff" ac:name="info" ac:schema-version="1"> <ac:parameter ac:name="title">Notes</ac:parameter> <ac:rich-text-body> <p>Results are limited to pages from the current space (<em> <strong>Content Reporter</strong> &gt; <strong>Spaces</strong>:<strong>@self</strong> </em>)</p> <p>This report will search into the pages' storage format to match the name of the Global Template (<em> <strong>Text Filter</strong> &gt; <strong>Contains Value</strong>: {<u>name of the global template</u> </em>})</p> <p>This report requires the following add-ons:</p> <ul style="list-style-type: square;"> <li> <a href="https://marketplace.atlassian.com/apps/186/reporting-for-confluence?tab=overview&amp;hosting=datacenter">Reporting</a> </li> <li> <a href="https://marketplace.atlassian.com/apps/166/linking-for-confluence?tab=overview&amp;hosting=datacenter">Linking</a> (optional)</li> </ul> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="750cead2-a8de-41f8-960d-a2986617439a" ac:name="report-table" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="e1b1e217-3df1-41f3-ba4d-bb3b479a7b52" ac:name="content-reporter" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="fca70436-2774-4538-aef4-0d717b261d3b" ac:name="and-filter" ac:schema-version="1"> <ac:rich-text-body> <p style="letter-spacing: 0.0px;"> <ac:structured-macro ac:macro-id="471dfaa4-c7ac-427a-a512-4ad011dfc7ba" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="contains">live-template</ac:parameter> <ac:parameter ac:name="required">true</ac:parameter> <ac:parameter ac:name="">content:body&gt;text</ac:parameter> </ac:structured-macro> </p> <ac:structured-macro ac:macro-id="6e667691-6f76-44c7-9469-d8e8f4cddbed" ac:name="or-filter" ac:schema-version="1"> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="cb5ad4d5-6efd-4fee-850f-e360067f5f80" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="contains">GlobalTemplate1</ac:parameter> <ac:parameter ac:name="required">true</ac:parameter> <ac:parameter ac:name="">content:body&gt;text</ac:parameter> </ac:structured-macro> </p> <p> <ac:structured-macro ac:macro-id="efb0c0da-f687-4b36-a6a7-ceb94fb11440" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="contains">GlobalTemplate2</ac:parameter> <ac:parameter ac:name="required">true</ac:parameter> <ac:parameter ac:name="">content:body&gt;text</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p> <ac:structured-macro ac:macro-id="d42f9d4a-af44-4caa-8ee5-e46d73e72080" ac:name="text-sort" ac:schema-version="1"> <ac:parameter ac:name="">page:modifcation date</ac:parameter> </ac:structured-macro> </p> <p> <ac:structured-macro ac:macro-id="2f5e4f84-3c37-4384-a3d9-f25777699b6a" ac:name="text-sort" ac:schema-version="1"> <ac:parameter ac:name="">page:version comment</ac:parameter> </ac:structured-macro> </p> <p> <ac:structured-macro ac:macro-id="e9fc7c17-3e49-4614-86a5-a20b82d758e1" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="exclude">.*:.*</ac:parameter> <ac:parameter ac:name="">page:title</ac:parameter> </ac:structured-macro> </p> <p> <ac:structured-macro ac:macro-id="bb431cbb-4852-4dd6-98cf-7f22a0c55d69" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="exclude">Search for Pages created from Global Templates</ac:parameter> <ac:parameter ac:name="">page:title</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="76882072-0f6b-4a44-9e8e-a8767f123293" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Space</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="7eb97dfc-174c-488a-9a10-9da6c02ea2cd" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="link">true</ac:parameter> <ac:parameter ac:name="">content:space</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="620dbfbd-4a0f-427e-a227-9a96454e71da" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Page Title</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="279c45fb-7cc4-43f9-a590-896da0e54c6a" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="link">true</ac:parameter> <ac:parameter ac:name="">page:title</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="11359093-4141-45be-bb5a-8fe399a579eb" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Created</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="5bcfb1c1-9737-44e3-96eb-925d1157cf6a" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="format">dd MMM, yyyy</ac:parameter> <ac:parameter ac:name="">content:creation date</ac:parameter> </ac:structured-macro> by <ac:structured-macro ac:macro-id="aaf4a407-07f7-4d91-9681-9d17e29d8c8b" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="link">true</ac:parameter> <ac:parameter ac:name="">content:creator</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="bd557e5b-72e8-4cf8-a4e9-95e409dacd28" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Page ID</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="06dd7a29-168c-4838-a741-85bdd9b6af5d" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="link">true</ac:parameter> <ac:parameter ac:name="">page:id</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="20fa9a1e-8570-482b-987d-d8e0f8cc48f5" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Last Modified</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="0a564230-8621-491b-b65b-1f50f76feeb0" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="format">dd MMM, yyyy</ac:parameter> <ac:parameter ac:name="">content:modification date</ac:parameter> </ac:structured-macro> by <ac:structured-macro ac:macro-id="8fd829d4-7bad-42c4-82f5-7b12aafc343e" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="link">true</ac:parameter> <ac:parameter ac:name="">content:modifier</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="6a8b1a54-d902-40ba-88df-9c33b902f870" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Last version comment</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="91ab7c24-6c33-4f92-be33-e7344dc696a3" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">page:version comment</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="ccb3f9db-6ddd-4738-8b42-be1985130eaf" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:parameter ac:name="title">Links</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="2c794ad0-a256-48a4-8a61-c978c721d02c" ac:name="link-to" ac:schema-version="1"> <ac:parameter ac:name="linkText">Page Info</ac:parameter> <ac:parameter ac:name="content"> <ac:link> <ri:page ri:content-title="%title%" ri:space-key="REP" /> </ac:link> </ac:parameter> <ac:parameter ac:name="">page info</ac:parameter> </ac:structured-macro> <ac:structured-macro ac:macro-id="6f18084e-17f5-4adc-8ccb-442de34b95ca" ac:name="link-to" ac:schema-version="1"> <ac:parameter ac:name="linkText">History</ac:parameter> <ac:parameter ac:name="content"> <ac:link> <ri:page ri:content-title="%title%" ri:space-key="REP" /> </ac:link> </ac:parameter> <ac:parameter ac:name="">page history</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="c489591c-c3dd-4c61-85fb-efe8f122dd14" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:parameter ac:name="title">Actions</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="129ebacb-ea5b-477c-b934-13b171ecae66" ac:name="link-to" ac:schema-version="1"> <ac:parameter ac:name="popup">true</ac:parameter> <ac:parameter ac:name="linkText">Edit</ac:parameter> <ac:parameter ac:name="content"> <ac:link> <ri:page ri:content-title="%title%" ri:space-key="REP" /> </ac:link> </ac:parameter> <ac:parameter ac:name="">page edit</ac:parameter> </ac:structured-macro> <ac:structured-macro ac:macro-id="0a9c63d8-a290-439b-b812-4b8560963868" ac:name="link-to" ac:schema-version="1"> <ac:parameter ac:name="linkText">Remove</ac:parameter> <ac:parameter ac:name="content"> <ac:link> <ri:page ri:content-title="%title%" ri:space-key="REP" /> </ac:link> </ac:parameter> <ac:parameter ac:name="">page remove</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro>

Macro structure

You can recreate the example in the editor view:

Steps

  1. Add a Report Table macro.

  2. Within the Report Table macro, add a Content Reporter macro with Spaces: @self

  3. Within the Content Reporter macro, add an And Filter macro.

  4. Within the And Filter macro, create a Text Filter macro with the following parameters:

    • Key: content:body>text

    • Contains Value: live-template

    • Required: selected

  5. Within the And Filter macro, under the Text Filter macro, create an Or Filter macro.

  6. Within the Or Filter macro, create a Text Filter macro with the following parameters:

    • Key: content:body>text

    • Contains Value: <GlobalTemplate1>(Change this value to your Global Template name).

    • Required: selected

  7. Within the Or Filter macro, under the Text Filter macro, add another Text Filter macro with the following parameters:

    • Key: content:body>text

    • Contains Value: <GlobalTemplate2>(Change this value to your Global Template name).

    • Required: selected

  8. Within the Content Reporter macro, under the And Filter macro, add two Text Sort macros with Key values page:modifcation date and page:version comment.

  9. Within the Content Reporter macro, under the Text Sort macros, add two Text Filter macros with the following parameters:

Parameter

Value for the first Text Filter macro

Value for the second Text Filter macro

Parameter

Value for the first Text Filter macro

Value for the second Text Filter macro

Key

page:title

page:title

Exclude

.*:.*

(Excludes the pages that contain the colon (:) symbol in their page title.)

<Page Title>

(Change this value to the title of the page this report resides on.)

  1. Under the Content Reporter macro, create six Report Column macros, each nested with Report Info macros as follows:

Report Column macro parameters

Nested Report Info macro parameters

Report Column macro parameters

Nested Report Info macro parameters

Title: Space

  • Key: content:space

  • Link to Item: selected

Title: Page Title

  • Key: page:title

  • Link to Item: selected

Title: Created 

First Report Info macro:

  • Key: content:creation date

  • Format: dd MMM, yyyy

Text between the two Report Info macros: by

Second Report Info macro:

  • Key: content:creator

  • Link to Item: selected

Title: Page ID

  • Key: page:id

  • Link to Item: selected

Title: Last Modified

First Report Info macro:

  • Key: content:modification date

  • Format: dd MMM, yyyy

Text between the two Report Info macros: by

Second Report Info macro:

  • Key: content:modifier

  • Link to Item: selected

Title: Last version comment

Key: page:version comment

  1. Create two more Report Column macros, each nested with two Link to Location macros as follows:

Report Column macro parameters

Nested Link to Location macro parameters

  • Title: Links

  • Injected: selected

First Link to Location macro:

  • Location: page info

  • Link Text: Page Info

Second Link to Location macro:

  • Key: page history

  • Link Text: Page History

  • Title: Actions

  • Injected: selected

First Link to Location macro:

  • Location: page edit

  • Link Text: Edit

  • Content: %title%

Second Link to Location macro:

  • Location: page remove

  • Link Text: Remove

  • Content: %title%

How to use the report

This report will search through the storage format of all the pages from the current space. It will search for the name of the Global Template defined in the Text Filter macros.

For example, if the name of the global template is GlobalTemplate1, edit the Text Filter macro and enter the name of the global template in the Contains Value field to get the list of pages using the template. (See image below.)

  1. The first Text Filter macro will make sure that only pages with the Live Template macro are listed.

  2. To search for a global template, edit this Text Filter macro to enter the name of the global template in its Contains Value field.

  3. This Text Filter is used to exclude the Reporting page from appearing in the results. Because the report is searching through the storage format, and the template name exists on the Reporting page, we add the Reporting page title into the Exclude field. You can change this value according to your Reporting page title.