Skip to main content
Skip table of contents

Generating a List of Redirecting Pages

Scenario

The Redirect macro (from the add-on Redirection for Confluence) allows you to set a page redirection. This is useful to redirect users from an old page to a new one, especially after removing or updating pages.

This recipe generates a list of pages containing the Redirect macro. A non-redirecting link is included with additional options to View, Edit, or Remove the page.

Result

Recipe

Apps


Linking for Confluence Server, Reporting for Confluence, Redirection for Confluence


Platform

Server

Level

Intermediate

Estimated time

20 minutes ⏱

Macros

N/A

Suppliers

Page Supplier

Storage format

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

<ac:structured-macro ac:macro-id="f7d310fd-a355-4b71-9e92-be072d21e17b" ac:name="report-table" ac:schema-version="1">
  <ac:rich-text-body>
    <p class="auto-cursor-target">
      <br />
    </p>
    <ac:structured-macro ac:macro-id="44659df1-4309-462f-a62e-a205ba17f7eb" ac:name="content-reporter" ac:schema-version="1">
      <ac:parameter ac:name="types">+page</ac:parameter>
      <ac:parameter ac:name="spaces">
        <ri:space ri:space-key="@global" />
      </ac:parameter>
      <ac:rich-text-body>
        <ac:structured-macro ac:macro-id="8eeed64e-acac-4514-b939-0ad0717b8b3e" ac:name="text-filter" ac:schema-version="1">
          <ac:parameter ac:name="include">.*redirect.*</ac:parameter>
          <ac:parameter ac:name="">page:body &gt; body:text</ac:parameter>
        </ac:structured-macro> <ac:structured-macro ac:macro-id="d05961c7-74a6-4c31-92c0-3063b75e741f" ac:name="text-sort" ac:schema-version="1">
          <ac:parameter ac:name="">page:space</ac:parameter>
        </ac:structured-macro> <ac:structured-macro ac:macro-id="e36addfd-7f4d-41e5-88c1-a7b470f94314" ac:name="text-sort" ac:schema-version="1">
          <ac:parameter ac:name="">page:title</ac:parameter>
        </ac:structured-macro>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br />
    </p>
    <ac:structured-macro ac:macro-id="218dd95a-31eb-4418-9296-0d4754f065f3" 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="3ff36c6c-c462-4210-96cb-19ebd782b883" ac:name="report-info" ac:schema-version="1">
            <ac:parameter ac:name="">page:title</ac:parameter>
          </ac:structured-macro>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br />
    </p>
    <ac:structured-macro ac:macro-id="8a0a62dc-625e-4c5a-809f-f82d16212626" 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="fa0b57ab-9a7c-45e2-b335-4129a24235b0" ac:name="report-info" ac:schema-version="1">
            <ac:parameter ac:name="">page:space</ac:parameter>
          </ac:structured-macro>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br />
    </p>
    <ac:structured-macro ac:macro-id="fe1cf538-41e4-4485-94e0-87cf43ea1f14" 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 class="auto-cursor-target">
          <br />
        </p>
        <ac:structured-macro ac:macro-id="2adb506c-298a-4cd1-ab07-ac088eb67866" ac:name="report-link" ac:schema-version="1">
          <ac:parameter ac:name="postfix">?&amp;redirect=false</ac:parameter>
          <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
          <ac:parameter ac:name="">page:url</ac:parameter>
          <ac:rich-text-body>
            <p>View</p>
          </ac:rich-text-body>
        </ac:structured-macro>
        <p>
          <ac:structured-macro ac:macro-id="11f7c459-fe37-41de-aaf7-e2841e49aee5" ac:name="link-to" ac:schema-version="1">
            <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="b0b1faf3-b960-4c11-b2cd-c5d10605a01a" 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>
    <p class="auto-cursor-target">
      <br />
    </p>
  </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, create a Content Reporter macro.
    Enter "@global" in the field for the Spaces parameter.
    Enter "+page" in the field for the Types parameter.

  3. Within the Report Table but under the Content Reporter, create a Report Column macro.
    Set the Title parameter to "Page Title".

  4. Within the Report Column macro, create a Report Info macro.
    Set the Key parameter to "page:title".

  5. Create another Report Column macro under the other one you just created.
    Set the Title parameter to "Space".

  6. Within the Report Column macro, create a Report Info macro.
    Set the Key parameter to "page:space".

  7. Create yet another Report Column macro under the last one you created.
    Set the Title parameter to "Actions".
    Ensure the Injected parameter is true.

  8. Within the Report Column macro, create a Report Link macro.
    Set the Key parameter to "page:url".
    Set the URL postfix parameter to "?&redirect=false".
    Within the Report Link macro, type in "Link".

  9. Back in the last Report Column macro and under the Report Link macro, create a Link to Location macro.
    Set the Location parameter to page edit.
    Enter "Edit" in the Link Text parameter.
    Enter "%title%" in the field for the Content parameter.

  10. Create another Link to Location macro right next to the one you just created.
    Set the Location parameter to page remove.
    Enter "Remove" in the Link Text parameter.
    Enter "%title%" in the field for the Content parameter.

Line-by-Line Explanation

n/a

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.