Listing Pages created from Global Templates

Scenario

There may be times when it is useful to look for pages that are created from Global Templates.

If you are planning on migrating to Confluence Cloud, there is a CCMA limitation on migrating Global Templates (Atlassian bug report: MIG-190). So, you will need to convert your Global Templates into Space Templates (more details here) and this recipe may be helpful for you.

This recipe generates a list of pages that are created from Global Templates. To display the list of pages using that template, you will need to provide the name of the Global Template into the report.

Result

Recipe

Apps

Reporting for Confluence Server & Data Center, Linking for Confluence Server

Apps

Reporting for Confluence Server & Data Center, Linking for Confluence Server

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 and set Spaces to "@self". 

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

  4. Inside the And Filter macro add a Text Filter and set the following:

    1. Key to content:body>text

    2. Contains Value to live-template

    3. Tick the Required checkbox

  5. Right below the Text Filter, add an Or Filter and it add two Text Filter macros (to search for multiple Template names) and set the following for each:

    1. Key to content:body>text

    2. Contains Value to GlobalTemplate1 (Change this value to your Global Template name). For the second Text Filter macro, set Contains Value to  GlobalTemplate2.

    3. Tick the Required checkbox

  6. Outside the And Filter macro, add two Text Sort macros and set the following values respectively:

    1. Key to page:modifcation date

    2. Key to page:version comment

  7. Below the Text Sort macros, add two Text Filter macros.

  8. For the first Text Filter macro, set the following values:

    1. Key to page:title

    2. Exclude to .*:.* (This will omit any pages that contain : in their page title.)

  9. For the second Text Filter macro, set the following values:

    1. Key to page:title

    2. Exclude to Page Title (Change this value to the title of the page this report resides on.)

  10. Now, create the table columns below by following these steps:

Column

Steps

Column

Steps

Space

Inside the Report Table macro, add a Report Column macro and set the Title to "Space".
Then add a Report Info macro and set the Key to content:space and Link to True.

Page Title

Add another Report Column macro and set the Title to "Page Title".
Then add a Report Info macro and set the Key to page:title and Link to True.

Created 

Add another Report Column macro and set the Title to "Created".
Then add a Report Info macro and set the Key to content:creation date and set the Format to dd MMM, yyyy.
Then, type "by" and add another Report Info macro. Set the Key to content:creator and Link to True.

Page ID

Add another Report Column macro and set the Title to "Page ID".
Then, add a Report Info macro and set the Key to page:id  and Link to True.

Last Modified

Add another Report Column macro and set the Title to "Last Modified".
Then add a Report Info macro and set the Key to content:modification date and set the Format to dd MMM, yyyy.
Then, type "by" and add another Report Info macro. Set the Key to content:modifier and Link to True.

Last version comment

Add another Report Column macro and set the Title to "Last version comment".
Then add a Report Info macro and set the Key to page:version comment.

Links

Add another Report Column macro and set the Title to "Links" and set Injected to True.
Then add a Link to Location macro and set Location  to page info and Link Text to "Page Info".
Then add a Link to Location macro and set Location  to page history and Link Text to "Page History".

Actions

Add another Report Column macro and set the Title to "Actions" and set Injected to True.
Then add a Link to Location macro and set Location  to page edit and Link Text to "Edit" and Content to %title%.
Then add a Link to Location macro and set Location  to page remove and Link Text to "Remove" and Content to %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 the Contains Value field to get the list of pages using the template. (See image below.)

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

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

  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. Feel free to change this value according to your Reporting page title.