This macro imports content from another source and renders it from the perspective of the current page.

Usage

This macro differs from the regular Confluence Include macro in that the content is rendered in the context of the current page rather than the source page.

This subtle difference is particularly useful when you want to store re-usable chunks of menu items on a page. This is because those menu items may have specific privilege requirements (depending on where they are used) in order to be rendered in the context of the current page. Use the Include macro in order to always show the correct values and links.

The security restrictions of the source page are honored. If the user is not allowed to see the source page, this macro is unable import it.

Storage Format

<ac:macro ac:name="import">
<ac:parameter ac:name="parameter">value</ac:parameter>
</ac:macro>

Wiki Markup

{import:parameter=value}

Parameter

Name

Description

Type

Default

Required

import

Import From

The name of the page to import, or the skin resource in SKINID::RESOURCE format (the extension will be determined by the Import macro and will define how it is rendered)

confluence-content


render

render

Render the imported content

boolean

true

output

output

Output the imported content (Switch this off when you are just importing logic)

boolean

true

flag

Flag

A list of flags, one of which must be defined for the content to be displayed

string


notflag

Not Flag

A list of flags which must not be defined for the content to be displayed

string


Panel Example

Import the content of a page from another space to show in your theme skin.

<ac:macro ac:name="import">
<ac:parameter ac:name="import">ds:More information</ac:parameter>
</ac:macro>
{import:ds:More information}

Result

By adding the Import macro to the Content panel you can show the content of any page at the bottom of all your pages.

Page Example

On any page, use the Macro Browser to insert the Import macro. This displays a screen with fields to enter the Space Key and Name of the page. Upon typing the page name, a dropdown of available pages shows.

Result

Alternate Sources

One of the most powerful features of the Import macro is that it is not restricted to importing content from pages. It is also capable of sourcing content from Space and Global templates, Editable Text objects, and Layout resources. This is achieved through a series of checks and fall-backs. If data is not found matching the page name in the first location, the next is checked until all options are exhausted and a not found error is displayed.

The series of checks is as follows:

  1. A space level Editable Text object (only editable by space admins)

  2. A Global level Editable Text object (only editable by site admins)

  3. A page in the current space (normal page permissions apply)

  4. A Space level template

  5. A Global level template

  6. A resource on the current skin (or one of its parents) with the .xml extension (rendered as Storage Format)

  7. A resource on the current skin (or one of its parents) with the .xhtml extension (rendered as Storage Format)

  8. A resource on the current skin (or one of its parents) with no extension (output as raw HTML)

  9. A resource on the current skin (or one of its parents) with the .html extension (output as raw HTML)

  10. A resource on the current skin (or one of its parents) with the .wiki extension (rendered as wiki markup)

By combining the capabilities of the skin resources and either pages in the space or editable text objects it is possible to create a skin that is customizable by space admins or users without them needing to edit the skin itself.