...
Pages can be retrieved based on:
- a specific page name,
- page hierarchy (parent/child relationships),
- page labels, and
- metadata keys or key:value pairs which the pages must have.
The macro searches for pages based on these properties in the current space by default, or in any number of spaces which can be specified in the macro parameters.
...
Expand |
---|
| Display or link to an attachment from an ancestor page |
---|
| Display or link to an attachment from an ancestor page |
---|
|
Wiki Markup |
Let's start with a simple example: rendering an image attached to the parent page, into the body of the current page.
{ Code Block |
---|
}
Show image attached to the parent page:
{with-page:direction=up}
!image.jpg!
{with-page}
{code}
Which results in:
Show image attached to the parent page:
{with-page:direction=up}
!image.jpg!
{with-page}
Although | Although image.jpg is attached to the parent page, it is rendered in this page. The body of the macro is the same syntax as if it were written in the parent page.
Similarly, any attachment to any parent page can be rendered or linked to the current page. Since the page can be found by labels and metadata, the specific page name is not required. For instance:
{ Code Block |
---|
}
Link to "sample.pdf" attached to the first parent page labeled "topic":
{with-page:direction=up|label=topic}
[^sample.pdf]
{with-page}
{code}
Which results in:
Link to "sample.pdf" attached to the first parent page labeled "topic"
{with-page:direction=up|label=topic}
[^sample.pdf]
{with-page}
|
|
Expand |
---|
| Find a page in the current tree with a given label and render its attachments in the current page |
---|
| Find a page in the current tree with a given label and render its attachments in the current page |
---|
|
Wiki Markup |
---|
Suppose there is a page somewhere in the current tree (not necessarily a direct parent, child or sibling) which has attachments we want to use in the current page. We can combine \{with-page} macros, first searching up the tree, then within that macro search down the tree again, looking for the page. Finally, we provide markup making use of the attachments found.
{code}
Find page labeled 'sponsors' in the current page tree, knowing it is a child of a parent page with the label 'homepage', then render the images attached to the page labeled 'sponsors' in a gallery on the current page:
{with-page:direction=up|label=homepage}
{with-page:direction=down|label=sponsors}
{gallery}
{with-page}
{with-page}
{code}
Which results in:
Find page labeled 'sponsors' in the current page tree, knowing it is a child of a parent page with the label 'homepage', then render the images attached to the page labeled 'sponsors' in a gallery on the current page
{with-page:direction=up|label=homepage}
{with-page:direction=down|label=sponsors}
{gallery}
{with-page}
{with-page}
|
|
Expand |
---|
| Displaying content in a sidebar specific to the current page's location in the page tree |
---|
| Displaying content in a sidebar specific to the current page's location in the page tree |
---|
|
Wiki Markup |
---|
If you are using a page to include in a sidebar on all pages in a space, you can use the \{with-page} macro to show content in the sidebar depending on the location of the current page.
For instance, if you have a Forum set up (using the [Bubbles:|Doobya:Bubbles] plugin) you can show information in the sidebar relevant to the forum, only on forum pages.
In this example, we will display a list of child pages to the Forum page, labeled 'sticky':
{code}
Forum-specific content for the sidebar
{with-page:direction=up|startPage=@self|title=Forum}
This will only appear when you're in the %withpagetitle% section of the space.
{list-descendants:startPage=@self|label=sticky}
{with-ancestor}
{code}
Which results in:
Forum-specific content for the sidebar
{with-page:direction=up|startPage=@self|title=Forum}
This will only appear when you're in the %withpagetitle% section of the space.
{list-descendants:startPage=@self|label=sticky}
{with-ancestor}
|
|
...