Searching for URLs that contain a specific string

Scenario

In this recipe, you are able to search for URLs that contain a certain string of text.

In this example, the user has migrated to a new server and must now fix many broken links that used to point to old.domain.net to new.domain.net. To make this task easier, the user wants to search for only external URLs that include "sharepoint", so that they can find all links on their Confluence that go to their SharePoint platform.

This can be performed with Expanding Reporter.

Result

Recipe

Apps

Reporting for Confluence Server & Data Center

Apps

Reporting for Confluence Server & 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&gt;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&gt;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

  1. Create a Report Table macro.

  2. Within the Report Table macro, create an Expanding Reporter macro.
    Set the Key parameter to content:outgoing.
    Set the As parameter to "Outlink".

  3. Within the Expanding Reporter macro, create a Content Reporter macro.
    Set the Types parameter to "page".

  4. Still within the Expanding Reporter macro, but under the Content Reporter macro, create a Boolean Filter macro.
    Set the Key parameter to link:is external.
    Check both Value and Required parameters.

  5. Still within the Expanding Reporter macro, but under the Content Reporter macro, create Text Filter macro.
    Set the Key parameter to link:url.
    Set the Include parameter to ".*sharepoint.*".

  6. Back within the Report Table macro, create a Report Column macro.
    Set the Title parameter to "Page".

  7. Within the Report Column macro, create a Report Info macro.
    Set the Key parameter to expanded:item.
    Check the Link to Item parameter.

  8. Back within the Report Table macro, create a Report Column macro.
    Set the Title parameter to "URL".

  9. Within the Report Column macro, create a Report Info macro.
    Set the Key parameter to expanded:Outlink>link:url.

  10. Back within the Report Table macro, create a Report Column macro.
    Set the Title parameter to "External".

  11. Within the Report Column macro, create a Report Info macro.
    Set the Key parameter to expanded:Outlink>link:is external.