Searching 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 macro name. You'd have to use the markup name of the macro for this to work. For example: "expanding-reporter" instead of "Expanding Reporter" and "content-reporter" instead of "Content Reporter".
Result
Recipe
Apps | Reporting for Confluence Server & 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>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
Add a Report Table macro.
Within the Report Table macro, add a Content Reporter macro.
Set the Spaces parameter to "@all".Within the Content Reporter macro, add a Text Filter macro.
For the Key parameter, use the following keychain: "content:body>text".
Then check the Required parameter.
For the Contains Value parameter, enter "expanding-reporter" (or any other macro you would like to search for.)Under the Content Reporter macro, create a Report Column macro.
Set the Title parameter to "Page Title".Within the Report Column macro, create a Report Info macro.
For the Key parameter, use the following keychain: "page:title"
Then check the Link to Item parameter.
Line-by-Line Explanation
N/A