Build a link URL based on a Scaffolding text field

Build a link URL based on a Scaffolding text field

Scenario

This recipe uses the Scaffolding Text Data macro and Reporting macros to direct a user to a web page depending on what the user accesses. It includes the ability to enter a search keyword using Wikipedia and be directed to a specific page.

Result

Recipe

Apps

Reporting for Confluence Data Center, Scaffolding

 

Level

Easy

Estimated time

10 minutes

Macros

Report Link, Report On

Suppliers

Scaffold Data Supplier

Storage format

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

<h5> <span class="uiOutputText">Enter URL prefix:</span> </h5> <ac:structured-macro ac:macro-id="151b200e-68c7-4a50-bb68-0a793cbc008b" ac:name="text-data" ac:schema-version="1"> <ac:parameter ac:name="name">URLprefix</ac:parameter> <ac:parameter ac:name="type">line</ac:parameter> <ac:parameter ac:name="content">text</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> <h5> <span style="color: rgb(112,112,112);">Enter website page</span> </h5> <ac:structured-macro ac:macro-id="32d56360-37dd-46c3-8081-fea78891c5fe" ac:name="text-data" ac:schema-version="1"> <ac:parameter ac:name="name">Website Page</ac:parameter> <ac:parameter ac:name="type">line</ac:parameter> <ac:parameter ac:name="content">text</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> <h5> <span class="uiOutputText">Link Output (using report-on):</span> </h5> <ac:structured-macro ac:macro-id="3009e2e2-5e2f-424e-a655-5ffe2af97b17" ac:name="report-on" 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> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="a367eda8-1349-43d8-b5c1-7be5b5fe5c61" ac:name="report-link" ac:schema-version="1"> <ac:parameter ac:name="postfix">%data:Website Page%</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:parameter ac:name="">data:URLprefix</ac:parameter> <ac:rich-text-body> <p> <span>%data:Website Page%</span> </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 Text Data macro (from the Scaffolding app) for the user to enter the URL, with the following parameters:

    • Name: URLprefix

    • Type: line

    • content: text

  2. Create another Text Data macro for the user to enter the keyword, with the following parameters:

    • Name: Website Page

    • Type: line

    • content: text

  3. Create a Report On macro with Injected: selected.

  4. Within the Report On macro, create a Report Link macro with the following parameters:

    • Key: data:URLprefix

    • URL Postfix: %data:Website Page%

  5. Save the page.

Now, you can click Edit Contents to enter the URL and keyword.