Search for URLs that contain a specified string
Scenario
With this recipe, you can search for URLs that contain a specified string of text.
For example, if you migrated to a new server, you must now fix many broken links that used to point to <old.domain.net> to <new.domain.net>. The following recipe searches for only external URLs that include sharepoint, so that you can find all links on your Confluence that go to your SharePoint platform.
Result
Recipe
Apps | Reporting for Confluence Data Center |
|---|---|
Level | Intermediate |
Estimated time | 20 minutes |
Macros | Boolean Filter, Content Reporter, Expanding Reporter, Report Column, Report Info, Report Table, Text Filter |
Suppliers | Content Supplier, Expanded Supplier, Link Supplier |
Storage format
You can copy and paste this code into the Confluence Source Editor:
<ac:structured-macro ac:macro-id="8ba071ec-fc06-4055-8f61-7d7434e90645" ac:name="report-table" ac:schema-version="1">
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="9c2851a0-624a-4d12-8825-dcc935ad00e6" ac:name="expanding-reporter" ac:schema-version="1">
<ac:parameter ac:name="as">Outlink</ac:parameter>
<ac:parameter ac:name="">content:outgoing links</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="e992a37b-bb6f-4ba8-9383-b5042b9ac7ca" ac:name="content-reporter" ac:schema-version="1">
<ac:parameter ac:name="types">page</ac:parameter>
<ac:rich-text-body>
<p>
<br />
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="9ff8d10a-0fad-4912-8150-9988c435288a" ac:name="boolean-filter" ac:schema-version="1">
<ac:parameter ac:name="value">true</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
<ac:parameter ac:name="">link:is external</ac:parameter>
</ac:structured-macro> <ac:structured-macro ac:macro-id="3679cf6d-209f-442f-aa1f-fdcace6566ca" ac:name="text-filter" ac:schema-version="1">
<ac:parameter ac:name="include">.*sharepoint.*</ac:parameter>
<ac:parameter ac:name="">link:url</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="6f1a8ee0-3328-4acd-9dad-a689098ccec8" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Page</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="eecb0e4a-3095-4c16-b497-fdd3c0524349" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="link">true</ac:parameter>
<ac:parameter ac:name="">expanded:item</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="0e7d7faf-6a64-41bb-8d2c-49c6aeeb760e" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">URL</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="f1214122-00f2-48d8-81bb-e3eff84c062b" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="">expanded:Outlink>link:url</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="3f009a6e-eee1-4383-8d84-17736c456a0f" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">External</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="0c4bb4b7-ac11-49cc-b7d5-382a02f9c23b" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="">expanded:Outlink>link:is external</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
Create a Report Table macro.
Within the Report Table macro, create an Expanding Reporter macro with the following parameters:
Key:
content:outgoingAs:
Outlink
Within the Expanding Reporter macro, create a Content Reporter macro with Types:
page.Within the Expanding Reporter macro, under the Content Reporter macro, create a Boolean Filter macro with the following parameters:
Key:
link:is externalValue: selected
Required: selected
Within the Expanding Reporter macro, under the Content Reporter macro, create a Text Filter macro with the following parameters:
Key:
link:URL.Include:
.*sharepoint.*
Within the Report Table macro, under the Expanding Reporter macro, create a Report Column macro with Title:
Page.Within the Page Report Column macro, create a Report Info macro with the following parameters:
Key:
expanded:itemLink to Item: selected
Under the Page Report Column macro, create another Report Column macro with Title:
URL.Within the URL Report Column macro, create a Report Info macro with Key:
expanded:Outlink>link:url.Under the URL Report Column macro, create another Report Column macro with Title:
External.Within the External Report Column macro, create a Report Info macro with Key:
expanded:Outlink>link:is external.