---
title: "Linking Jira with Confluence using Gaia for Jira app"
canonical: "https://support.appfire.com/space/GFJ/17629638/Linking%20Jira%20with%20Confluence%20using%20Gaia%20for%20Jira%20app"
format: markdown
---
> Macro (aura-html)

<span style="color: #333300">Gaia for Jira app allows you to create a new Confluence space once you create a new Jira Project. On this page, we would like to share some features that you can use to quickly and easily connect Jira and Confluence.</span>

## Pre-requisites

<span style="color: #333300">This tutorial was written considering that :</span>

- <span style="color: #333300">you have a Jira instance installed and running on your server with Gaia for Jira installed;</span>
- <span style="color: #333300">you have a Confluence instance installed and running on your server or you are using the Confluence Cloud service from Atlassian;</span>
- <span style="color: #333300">you are logged into Jira and Confluence.</span>

## Linking Jira issues with Confluence pages

<span style="color: #333300">This section contains the instructions to automatically create Jira issues links into the Confluence pages of your templates, by adding the Gaia tags for Jira issues.</span>

#### 1. Adding the <span style="color: #444444">Jira </span>Issues Gaia tags into a Confluence page :

<span style="color: #333300">In your Confluence Space template, create a link to a Jira issue, by adding the following tag element into your text</span>

`##ID:``mytag``##`

<span style="color: #333300">Where </span>*<span style="color: #333300">mytag</span>*<span style="color: #333300"> represents a unique string. The figure below depicts an example of using tags in a table element. Here,</span> *<span style="color: #0000ff">mytag</span>*<span style="color: #0000ff"> </span><span style="color: #333300">is replaced with</span> *<span style="color: #0000ff">1.1</span>* <span style="color: #333300">and</span> *<span style="color: #0000ff">1.2</span>*. <span style="color: #333300">Tags can be added anywhere in the text section of a Confluence page. </span>

![image](media://3d660821-c2e2-4108-a1c6-660fe537331a)

> ℹ️ **Valid characters for tags**
> ℹ️ 
> ℹ️ <span style="color: #333300">You may use alphanumeric characters, dashes, and dots only for</span> <span style="color: #0000ff">*mytag*</span>. <span style="color: #333300">Other characters are not supported. Also, we require that</span> <span style="color: #0000ff">*mytag*</span> <span style="color: #333300">is limited to 16 characters.</span>

#### 2. <span style="color: #003366">Add the same tag in the Jira issue you want to link :</span>

<span style="color: #333300">To associate a tag added into a Confluence page to any Jira issue, add the exact same tag in the </span><u><span style="color: #333300">Comments</span></u><span style="color: #333300"> section of a Jira issue, as shown below :</span>

![image](media://e5d4f75f-8231-4a7b-9a0e-5682b4351758)

> ❌ **Watch out the JIRA editor!**
> ❌ 
> ❌ <span style="color: #333300">Newer versions of Jira offer a rich-text editor for writing comments. Please note that formatting within the tag (such as bold characters) is not supported and may cause the tag not to be recognized by Gaia when creating new projects.</span>
> ❌ 
> ❌ <span style="color: #333300">Also, this editor replaces key names with their corresponding hyperlinks, which also changes the formatting of the tags (tags generally become blue and clickable). To avoid this, make sure you do not use key names for your tags. For instance, if your issue has MYPROJ-1 as issue key, do not use MYPROJ-1 as the tag name.</span>

#### 3. Create the template files:

<span style="color: #333300">To use this feature, you need to export your templates by creating the</span> [Jira issues file](https://appfire.atlassian.net/wiki/spaces/GFJ/pages/17629228/Creating+your+own+Jira+issues+file) <span style="color: #333300">and the</span> [Confluence Space file](https://appfire.atlassian.net/wiki/spaces/GFJ/pages/17629593/Creating+your+own+Confluence+space+file).  <span style="color: #333300">When the files are created, use them in your templates settings in the Gaia Configuration. </span>

<span style="color: #333300">You're done!</span>



## Linking Jira project with Confluence JQL queries

<span style="color: #333300">This section contains the instructions to automatically update the JQL queries used in Confluence macros, by adding Gaia tags.</span>

#### Adding the <span style="color: #444444">Jira</span><span style="color: #444444"> </span>project key Gaia tag into a Confluence JQL query:

<span style="color: #333300">In your Confluence Space template, when you specify a JQL query in a macro (e.g: Jira Issue) you can use the tag </span>`##PROJECTKEY##`<span style="color: #333300"> to add a reference to the project that will be created from that template.</span>

<span style="color: #333300">When the project will be created, Gaia for Jira will automatically replace this tag by the project key.</span>

<span style="color: #333300">For example:</span>

![image](media://73b48edd-023e-4b49-b541-679cf579e10b)

> ℹ️ **Confluence refuses to let me add my keys or queries**
> ℹ️ 
> ℹ️ <span style="color: #333300">Note that if you try to embed these keys into macros or JQL queries, they might sometimes be refused, as Confluence does not recognize them as a valid project. To bypass this limitation, you may need to edit the Confluence page source using a source editor</span> ([https://marketplace.atlassian.com/plugins/com.atlassian.confluence.plugins.editor.confluence-source-editor/server/overview](https://marketplace.atlassian.com/plugins/com.atlassian.confluence.plugins.editor.confluence-source-editor/server/overview)).



## Automating the insertion of the project title and project key in Confluence pages

<span style="color: #333300">This section contains the instructions to automatically insert the name of the space and the project key into Confluence pages or Confluence macros, by adding Gaia tags.</span>

### Inserting the project name or project key in a Confluence page

<span style="color: #333300">In a Confluence page content or page titles of your template, you may, at any time, add a tag to insert the project name or the project key after project instantiation. This allows generating more dynamic Spaces, which refer to the current project instance. Just add the following tags:</span>

| <span style="color: #333300">**Key**</span> | <span style="color: #333300">**Effect**</span> |
| --- | --- |
| `##PROJECTKEY##` | <span style="color: #333300">Will be replaced with the project key</span> |
| `##PROJECTTITLE##` | <span style="color: #333300">Will be replaced with the project name</span> |

### Inserting the project name or project key in a Confluence macro

<span style="color: #333300">Besides, you may also insert these tags in Confluence macros. For instance, the Roadmap Planner macro may refer to the tags described above.</span>

> Macro (roadmap)

> ℹ️ **How to edit macros and queries?**
> ℹ️ 
> ℹ️ <span style="color: #333300">Note that if you try to embed these keys into macros or JQL queries, they might sometimes be refused, as Confluence does not recognize them as a valid project. To bypass this limitation, you may need to edit the Confluence page source using a source editor</span> ([https://marketplace.atlassian.com/plugins/com.atlassian.confluence.plugins.editor.confluence-source-editor/server/overview](https://marketplace.atlassian.com/plugins/com.atlassian.confluence.plugins.editor.confluence-source-editor/server/overview)).