Search Confluence pages for a specific macro

Search Confluence pages for a specific macro

Scenario

This recipe allows you to search through Confluence pages for a specific macro, in this case, the Expanding Reporter macro.

To search for other macros, change the Contains Value parameter in the Text Filter macro to the corresponding markup name of the macro. For example, expanding-reporter for the Expanding Reporter macro, and content-reporter for the Content Reporter macro.

Result

Recipe

Apps

Reporting for Confluence Data Center

Level

Intermediate

Estimated time

15 minutes

Macros

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

Suppliers

Content Supplier, Page Supplier

Storage format

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

<h3>Find pages which has the Expanding Reporter macro:</h3> <p> <br /> </p> <ac:structured-macro ac:macro-id="15c1ce30-f6f6-4df2-a63b-f5b6448d9be0" ac:name="report-table" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="77f1cfac-7334-4b8b-8a62-acdd705418ad" ac:name="content-reporter" ac:schema-version="1"> <ac:parameter ac:name="spaces"> <ri:space ri:space-key="@all" /> </ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="b7fda223-c4c0-455b-b3e7-0b80012541ec" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="contains">expanding-reporter</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: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:rich-text-body> </ac:structured-macro>

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 Spaces: @all.

  3. Within the Content Reporter macro, create a Text Filter macro with the following parameters:

    • Key: content:body>text

    • Required: selected

    • Contains Value: expanding-reporter or any other macro that you want to search for

  4. Under the Content Reporter macro, create a Report Column macro with Title: Page Title.

  5. Within the Report Column macro, create a Report Info macro with the following parameters:

    • Key: page:title

    • Link To Item: selected