Going Stellar

Home/Confluence storage format reference

Confluence storage format

<ac:link> to a page in Confluence storage format

A page link is an ac:link whose first child is ri:page, naming the target by ri:content-title and optionally ri:space-key. The visible text comes from a link body or, when there is none, from the title. The linked page does not have to exist at save time.

Storage format

<ac:link>
<ri:page ri:content-title="Page Title" />
<ac:plain-text-link-body><![CDATA[Link to another Confluence Page]]></ac:plain-text-link-body>
</ac:link>
<ac:link><ri:page ri:content-title="Page Title" ri:space-key="SPACEKEY" /></ac:link>

As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

<p><ac:link><ri:page ri:content-title="Plugin developer tutorial stuff" ri:space-key="TECHWRITING" /></ac:link></p>
{
 "type": "doc",
 "content": [
  {
   "type": "paragraph",
   "content": [
    {
     "text": "Plugin developer tutorial stuff",
     "type": "text",
     "marks": [
      {
       "type": "link",
       "attrs": {
        "__confluenceMetadata": {
         "spaceKey": "TECHWRITING",
         "linkType": "page",
         "contentTitle": "Plugin developer tutorial stuff"
        },
        "href": "https://your-site.atlassian.net/wiki/pages/createpage.action?spaceKey=TECHWRITING&title=Plugin%20developer%20tutorial%20stuff"
       }
      }
     ]
    }
   ]
  }
 ],
 "version": 1
}

Examples

Storage format sent

<p><ac:link><ri:page ri:content-title="Page Title" /><ac:plain-text-link-body><![CDATA[Link to another Confluence Page]]></ac:plain-text-link-body></ac:link></p>

The page link example from the storage format page, pointing at a title that does not exist.

Rendered view (HTML)

<p><a class="createlink" href="/wiki/pages/createpage.action?spaceKey=SD&amp;title=Page%20Title&amp;linkCreation=true&amp;fromPageId=<page id>">Link to another Confluence Page</a></p>

Storage format after the round trip through ADF

<p><a href="https://your-site.atlassian.net/wiki/pages/createpage.action?spaceKey=SD&amp;title=Page%20Title&amp;linkCreation=true&amp;fromPageId=<page id>">Link to another Confluence Page</a></p>

Sent to Confluence Cloud on .

Storage format sent

<p><ac:link><ri:page ri:content-title="Plugin developer tutorial stuff" ri:space-key="TECHWRITING" /></ac:link></p>

A page link with no body, so the displayed text has to come from the target title.

Rendered view (HTML)

<p><a class="unresolved" href="#">Plugin developer tutorial stuff</a></p>

Storage format after the round trip through ADF

<p><a href="https://your-site.atlassian.net/wiki/pages/createpage.action?spaceKey=TECHWRITING&amp;title=Plugin%20developer%20tutorial%20stuff">Plugin developer tutorial stuff</a></p>

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="include"><ac:parameter ac:name=""><ac:link><ri:page ri:content-title="Page Title" /></ac:link></ac:parameter></ac:structured-macro>

A page reference used as a macro parameter, shown in the include page macro.

Rendered view (HTML)

<div class="error conf-macro output-block" data-hasbody="false" data-macro-id="<id>" data-macro-name="include"><span class="error">Unable to render {include}</span> The included page could not be found.</div>

Storage format after the round trip through ADF

<ac:structured-macro ac:name="include" ac:schema-version="1" ac:macro-id="<id>"><ac:parameter ac:name=""><ac:link><ri:page ri:content-title="Page Title" /></ac:link></ac:parameter></ac:structured-macro>

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="excerpt-include"><ac:parameter ac:name=""><ac:link><ri:page ri:content-title="Page Title" /></ac:link></ac:parameter></ac:structured-macro>

The same page reference in the excerpt include macro, which reports the missing page differently.

Rendered view (HTML)

<div class="error">Error rendering macro 'excerpt-include' : No link could be created for 'Page Title'.</div>

Storage format after the round trip through ADF

<ac:structured-macro ac:name="excerpt-include" ac:schema-version="1" ac:macro-id="<id>"><ac:parameter ac:name=""><ac:link><ri:page ri:content-title="Page Title" /></ac:link></ac:parameter></ac:structured-macro>

Sent to Confluence Cloud on .

What changes in conversion

  • A save through ADF turns an ac:link to a page into a plain a href. The ADF link mark holds an address plus a confluenceMetadata block with the space key, title and link type.
  • For a page that does not exist, that address is the create page action of the site with the space key and title in the query. The link text stays the same.
  • The ri:page attributes are reordered on save, with the space key written before the content title. The values are unchanged.
  • Inside a macro parameter the ac:link is left as written, and the macro itself returns unchanged.

Pitfalls

  • A link to a missing page is accepted and stored. The rendered view shows a create page link or an unresolved link, not an error, so a typo in the title surfaces only when someone clicks.
  • The include and excerpt include macros do show an error for a missing target, and each words it differently.
  • Without ri:space-key the missing page is resolved against the space of the page that holds the link, which the create page address showed as the space key. A page in another space needs the key.

Sources

  1. Confluence storage format (Atlassian Documentation)
  2. Insert the include page macro (Atlassian Support)
  3. Insert the excerpt include macro (Atlassian Support)

Markdown version · All storage format pages