Skip to end of banner
Go to start of banner

Building a Link URL Based on Text Field

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Current »

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 via Wikipedia and be directed to a specific page.

Result

Recipe

Apps

Reporting for Confluence Server & 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 for the user to enter the URL. Set the following parameters as stated:
    Name: "URLprefix"
    Type: "line"
    content: "text"

  2. Create another Text Data macro for the user to enter the keyword, and set the parameters as below:
    Name: "URLprefix"
    Type: "line"
    content: "text"

  3. Create a Report On macro, and check the injected parameter to set it to True.

  4. Within the Report On macro, create a Report Link macro. Set the parameters as below:
    Key: data:URLprefix
    URL Postfix: %data:Website Page%

  5. Save the changes. Now, you can click on Edit Contents to enter the URL and keyword.

  • No labels