Import
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 beneficial for storing reusable chunks of menu items on a page. This is because those menu items may have specific privilege requirements (depending on where they are used) to be rendered in the current page's context. Use the Include macro always to show the correct values and links.
The security restrictions of the source page are honored. If the user cannot see the source page, this macro is unable to 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 | 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 that 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 can also source 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:
A space level Editable Text object (only editable by space admins)
A Global level Editable Text object (only editable by site admins)
A page in the current space (normal page permissions apply)
A Space level template
A Global level template
A resource on the current skin (or one of its parents) with the .xml extension (rendered as Storage Format)
A resource on the current skin (or one of its parents) with the .xhtml extension (rendered as Storage Format)
A resource on the current skin (or one of its parents) with no extension (output as raw HTML)
A resource on the current skin (or one of its parents) with the .html extension (output as raw HTML)
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 page 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.