Part 2 - Creating the workaround

Overview

Create the workaround to the Incoming Links macro by making use of the Reporting for Confluence app.

This workaround is able to detect links from other pages from within Scaffolding macros that link to the current page.

In this example the Scaffolding macro structure used is the one we created in Part 1 - Creating the Scaffolding macro structure.

At the end of this step you should be able to see the following outcome (or similar).

Source code

The following source code is shared using Confluence Storage Format - the XHTML-based format that Confluence uses to store the content of pages, page templates, blueprints, blog posts and comments.

For more information on how to use this source code on your Confluence, read the following article - How do I use Recipes that use the Storage Format with the Confluence Source Editor?

<ac:structured-macro ac:macro-id="dd5d3949-cf06-4ca8-89e8-2011e80af547" ac:name="report-block" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="9b1377d7-9261-4e9d-8178-225bb81ef0d4" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="">@self</ac:parameter> <ac:rich-text-body> <p> <br/> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="58110463-dd54-4096-ae9d-1cfc458c3697" ac:name="report-header" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="81e66481-7026-44e5-bd6d-ccfa03b8ba4a" ac:name="report-variable" ac:schema-version="1"> <ac:parameter ac:name="name">X</ac:parameter> <ac:parameter ac:name="value">%page:title%</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <p> <br/> </p> </ac:rich-text-body> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="8d58ca5e-937e-4740-9e2a-3fe9acaf609f" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="d6a054b0-4f65-42a1-b5b3-ba27dda26e81" ac:name="report-block" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="593fb6d9-16fe-465c-903a-0f2bbee18b0b" 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="@all"/> </ac:parameter> <ac:rich-text-body> <p class="auto-cursor-target"> <ac:structured-macro ac:macro-id="9a93affd-253c-4f49-a708-38eb675a7d32" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="contains">%variable:X%</ac:parameter> <ac:parameter ac:name="minLength">1</ac:parameter> <ac:parameter ac:name="">data:target</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="4f7578e6-1f87-4d27-8935-745f1a14ec1e" ac:name="report-body" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="2f67e744-7f87-405e-bfec-5ecd6f10ea61" 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> </ac:rich-text-body> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro>

Steps

Within the Report Header macro

  • create a Report Variable macro

    • set the Name parameter to "X"

    • set the Value parameter to "%page:title%"

  • add a Report Body macro

Within the Report Body macro

  • add a Report Block macro

    • check its Injected parameter

Within the Report Block macro

Within the Report Body macro

  • add a Report info macro

    • set its Key to "page:title"

    • check the Link To Item parameter

Inside Content Reporter macro

  • add a Text Filter macro

    • set its key and contains parameters to "data:target" and "%variable:X%" respectively

  • choose Save

On the page

  • choose Edit contents

  • select your desired page

  • choose Save

Workaround is complete and added to your page.

Macro structure

Â