---
title: "How to use URLs in macros"
canonical: "https://support.appfire.com/space/HTML/70616292/How%20to%20use%20URLs%20in%20macros"
format: markdown
---
> Macro (aura-html)

<span style="color: #000000">This article discusses the recommended way of using URLs, especially in correlation with profiles, in the </span><span style="color: #000000">*Html-bobswift*</span><span style="color: #000000"> and</span><span style="color: #000000">* XSLT*</span><span style="color: #000000"> macros. This page also contains more information about the URLs that can be given, the order used to process URLs, and finally, how URLs must be used with profiles in the macros.</span>

<span style="color: #000000">You can connect to an external application or location through a URL and display relevant HTML/XML content on your pages. For this purpose, the macros allow you to use profiles and URLs to specify the complete path to access the required application data. The best practice though, is to specify both, a profile with a base URL and a relative path in the </span><span style="color: #000000">*Location*</span><span style="color: #000000"> fields in the macros configuration. This way, you can access multiple locations through the same profile, and render HTML/XML content on your pages.</span>

> ℹ️ <span style="color: #000000">Contact your Confluence administrator to know which profiles are available in your instance.</span>

## > Macro (anchor)

<span style="color: #000000">URLs in macros</span>

<span style="color: #000000">First, it is important to understand how the macro processes profiles and URLs. A URL provided in a macro can be:</span>

- <span style="color: #000000">an absolute URL that can be used to access the relevant HTML/XML file,</span>
- <span style="color: #000000">a relative path to the actual location of the file to be rendered, or</span>
- <span style="color: #000000">an application link (a link between Confluence and another Atlassian application such as Bitbucket or Jira).</span>

### > Macro (anchor)

<span style="color: #000000">Precedence in URL processing</span>

<span style="color: #000000">URLs given in the macros are processed in the following order as explained:</span>

| <span style="color: #000000">**Priority given**</span> | <span style="color: #000000">**URL type**</span> | <span style="color: #000000">**Description**</span> |
| --- | --- | --- |
| <span style="color: #000000">1</span> | <span style="color: #000000">Application links</span> | <span style="color: #000000">If the given URL is linked to a specific application like Bitbucket or Jira, the macro does not require any user credentials, and processes and renders the given file. </span>Refer to [application links](https://appfire.atlassian.net/wiki/x/14Q1B) for information. |
| <span style="color: #000000">2</span> | <span style="color: #000000">Profiles</span> | <span style="color: #000000">If </span><span style="color: #000000">*Profile*</span><span style="color: #000000"> is specified, the macro appends the URL given here with the URL specified in the profile configuration, and accesses the location to render the required file.</span> |
| <span style="color: #000000">3</span> | <span style="color: #000000">Simple URLs</span> | <span style="color: #000000">Lastly, if no application links or profiles were given, the URLs are processed as-is and the required file is rendered.</span> |

## > Macro (anchor)

<span style="color: #000000">Importance of URLs with respect to profiles</span>

<span style="color: #000000">The correlation between URLs and profiles with respect to the macro can be explained as:</span>

| <span style="color: #000000">**Is **</span><span style="color: #000000">***Profile***</span><span style="color: #000000">** given?**</span><br><span style="color: #000000">**(Y - Yes, N - No)**</span> | <span style="color: #000000">**Is **</span><span style="color: #000000">***Location***</span><span style="color: #000000">** given?**</span><br><span style="color: #000000">**(Y - Yes, N - No)**</span> | <span style="color: #000000">**Macro behavior**</span> |
| --- | --- | --- |
| <span style="color: #000000">Y</span> | <span style="color: #000000">N</span> | <span style="color: #000000">Accesses the URL specified in the profile through the pre-configured information.</span> |
| <span style="color: #000000">N</span> | <span style="color: #000000">Y</span> | <span style="color: #000000">Accesses the URL specified and renders the HTML or XML content as required.</span> |
| <span style="color: #000000">Y</span> | <span style="color: #000000">Y</span> | <span style="color: #000000">Appends the URL mentioned in the </span><span style="color: #000000">*Location of HTML data*</span><span style="color: #000000"> or</span><span style="color: #000000">* Location of XML data*</span><span style="color: #000000"> parameter to the </span><span style="color: #000000">*URL*</span><span style="color: #000000"> configured in the profile. Thus, the macro(s) creates an absolute path to the required file. If this path is not valid, a network error message is displayed. To resolve this issue, contact your Confluence administrator for more information.</span> |

## > Macro (anchor)

<span style="color: #000000">How it all works</span>

### <span style="color: #000000">Profile configuration</span>

<span style="color: #000000">For this example, let’s assume the profile has the following values specified:</span>

![Image shows a profile configuration.](media://408ea12f-e42d-46c1-a64c-ab280ab5fa0f)

> ⚠️ - <span style="color: #000000">Here, the profile is to be linked with GitLab and the base URL of the application is taken automatically in the </span><span style="color: #000000">*URL*</span><span style="color: #000000"> field. This URL is editable and can be changed according to your requirement.</span>
> ⚠️ - <span style="color: #000000">In the given screenshot, an </span><span style="color: #000000">*Access token*</span><span style="color: #000000"> is provided whereas the </span><span style="color: #000000">*User*</span><span style="color: #000000"> and </span><span style="color: #000000">*Password*</span><span style="color: #000000"> parameters are left empty. This is because the access token works almost like a direct link to the specified URL and thus, does not require user credentials. See the </span><span style="color: #000000">[profile configuration](https://appfire.atlassian.net/wiki/x/l4E1B#Configuration-html_57_config_profiles)</span><span style="color: #000000"> documentation for more information about access tokens.</span>
> ⚠️ - See the <span style="color: #000000">[Additional links](#HowtouseURLsinmacros-html_57_tutl_URLProfiles_AddlLinks)</span><span style="color: #000000"> </span><span style="color: #000000">section for more information about profile creation. </span>

### <span style="color: #000000">Macro editor settings</span>

1. <span style="color: #000000">Create or edit a page, add the </span><span style="color: #000000">*Html-bobswift*</span><span style="color: #000000"> macro (for this example), and edit to open the macro editor.</span>
2. <span style="color: #000000">Select the relevant profile in </span><span style="color: #000000">*Profile*</span><span style="color: #000000">.</span>
3. <span style="color: #000000">Enter a relative path (partial URL) to access the required file in </span>*Location to HTML data*<span style="color: #000000">.</span>
4. <span style="color: #000000">Save the macro and publish the page to see the content.</span>

> ℹ️ *Points to remember:*
> ℹ️ 
> ℹ️ - <span style="color: #000000">Profiles are a means to access and retrieve contents from external applications such as GitHub, GitLab, and so on.</span>
> ℹ️ - <span style="color: #000000">A profile already contains the base URL and the required credentials (user credentials or an access token) to access the relevant application.</span>
> ℹ️ - <span style="color: #000000">If you specify a profile in the macro editor, enter a </span><span style="color: #000000">*relative*</span><span style="color: #000000"> path in the </span><span style="color: #000000">*Location *</span><span style="color: #000000">fields to access the required file(s).</span>
> ℹ️ - <span style="color: #000000">You must specify a profile or a URL in the macro editor.</span>
> ℹ️ - <span style="color: #000000">If you specify an absolute URL in the </span><span style="color: #000000">*Location *</span><span style="color: #000000">fields, the macro can directly access the file(s) in the specified path.</span>

## > Macro (anchor)

<span style="color: #000000">Additional links</span>

- <span style="color: #000000">[Add a GitHub profile](https://appfire.atlassian.net/wiki/x/IIU1B)</span>
- <span style="color: #000000">[Add a GitLab profile](https://appfire.atlassian.net/wiki/x/FoU1B)</span>
- <span style="color: #000000">[Create a profile with URL](https://appfire.atlassian.net/wiki/x/94Q1B)</span>
- <span style="color: #000000">[User guide](https://appfire.atlassian.net/wiki/x/4YE1B)</span>
- <span style="color: #000000">[Administrator guide](https://appfire.atlassian.net/wiki/x/r4M1B)</span>