|
|
|
|
|
{incoming-links} Macro
Overview
The {incoming-links} macro displays a customisable list of incoming links for the current page...
There are many occasions when it's useful to know what other pages link to the current page as they will almost always be related to the current page and therefore be of some use to the person viewing the page.
This macro allows you to add a customisable list of incoming pages that can also be filtered to specific Spaces and content types, etc.
Usage
The macro has the following parameters:
Parameters
| Parameter |
Required |
Default |
Notes |
| mode |
 |
list |
The type of output, either:
- list (default) - a bullet list of incoming links
- flat - a flattened (single line) list of incoming links
|
| style |
 |
icons |
The style of bullet point to use for each item when using the list type:
- none – no marker
- icons – the default style showing icons to depict content type
- Any valid CSS style (see the Styles tab above)
|
| separator |
 |
brackets |
When using the flat mode, this parameter defines how individual items will be separated from one another:
- brackets (default) – items will be enclosed in [USERGUIDE:square] [USERGUIDE:brackets]
- braces – items will be enclosed in {curly} {braces}
- parens – items will be enclosed in (normal) (brackets)
- pipe – items will be separated | by | pipes
- Anything else – a custom separator
|
| spaces |
 |
|
By default, incoming links from any space that the user has access to will be listed. You can use this parameter to filter the links to one or more spaces (if using more than one space, separate the space keys with commas). |
| types |
 |
All Types |
By default, all content types that link to the current page will be listed. You can however specify a comma separated list of specific comment types to include. The available content types are:
- page – pages
- blogpost – news articles (blog posts)
- comment – comments (does not appear to work due to a bug in Confluence)
- spacedescription – the description for a space
- userinfo – user profile
- mail – mail archive message
|
| parent |
 |
Any |
If you want to restrict the list of incoming links to a page with a specific parent page, use this parameter. |
| ancestor |
 |
Any |
If you want to restrict the list of incoming links to a page with a specific ancestor page (ie. a page further up the site hierarchy), use this parameter to specify the ancestor page. |
| excerpt |
 |
false |
Set to true to display excerpts for the incoming link (create excerpts using the excerpt macro). |
| sort |
 |
natural |
Specify the sort order of the displayed links:
- natural (default) – A natural sort on the title (eg. 1, 2, 3, .. 10, etc)
- bitwise – A bitwise sort on the title (eg. 1, 10, 2, 3, ... etc)
- creation – Sorted by creation date of the content
- modified – Sorted by the date the content was last modified
|
| first |
 |
|
Limit the list of incoming links to the first x links, eg. first=5 will only show a maximum of 5 links |
| reverse |
 |
false |
If set to true, the sort order of the incoming links will be reversed. |
Styles
Depending on your web browser and installed unicode sypport, you may get varying results with the style parameter. Click the following links for more information:
Styles in your browser
The following chart shows examples of the CSS styles that can be used and how they look in your own web browser:
|
disc:
circle:
square:
decimal:
decimal-leading-zero:
|
lower-roman:
upper-roman:
lower-alpha:
upper-alpha:
lower-greek:
|
lower-latin:
upper-latin:
hebrew:
armenian:
georgian:
|
cjk-ideographic:
hiragana:
katakana:
hiragana-iroha:
katakana-iroha:
|
The first two columns above are the most widely supported styles. The other styles generally require an operating system and web browser both capable of rendering Unicode characters.
Correct styles
The following chart shows what the styles should look like if everything is configured properly:
Examples of style faults
The following chart shows what the styles often look like on systems that don't have full unicode support:
License
This software is released under a BSD License
© 2005 David Peterson
Examples
Basic Use - List all Incoming Links
When used without any parameters, the macro will display a list of all incoming links:
Resulting in this:
If there were no icoming links, the user would see the following message:
If you don't add a message to display when there are no links, the macro will not display anything!
Limiting Number of Links
If you want to limit the number of incoming links shown, use the following notation:
In the example above, we're limiting to just the first 2 links:
Styles and Indents
By default, the list mode output will show icons to depict different types of content as shown in Example #1. However, you can choose a different item marker using the style parameter:
Which results in:
You can see examples of all the CSS style options in the associated tabs at the top of this page.
You can also turn off the marker completely by setting style to none:
Which results in:
Output Mode
By default, the links will be output as a list, however you can also output them as a flat navigation bar:
Resulting in:
children macro, excerpt-include macro, excerpt macro, page-info macro
As you can see, we didn't include the usual "No incoming links" message between the macro tags - there's no point (usually) in displaying a message in this case. Because the macro will create a blank line (which would look odd), we simply put a few hyphens in instead.
You can make the output look nicer by centering it with the center macro as follows:
Resulting in:
Customising the Flat Style
Filtering Content Types
By default the macro will list incoming links from all types of content, but you might prefer to limit the list to specific types of content. For example, we've got a news item linking to this page (only as an example) that's not much use:
To get rid of it, we restrict the content types that are reported on - let's say pages and comments:
Resulting in:
Alternatively, we might only want to show new items (known internally as "blogposts"):
Resulting in:
—
Alternate Sort Methods
To sort incoming links based on the date the content was created, use the following:
Resulting in:
To sort incoming links based on the date the content was last modified, use the following:
Resulting in:
The bitwise sort mode is almost the same as the default natural sort mode – it's faster, but not as good at sorting titles with numbers in them. You should only ever need the bitwise sort if you've got really massive lists of incoming links.
Reverse Sort Order
To reverse the sort order, simply add the reverse parameter:
Resulting in:
Filtering Links based on Parent, Ancestor and Space
There will be times when you want to limit links based on where tehy are coming from - especially if you have lots of incoming links!
The first method is based on the parent page - only links attached directly to the page specified will be listed:
In the example above, only incoming links from pages attached to the Navigation and Lists page will be displayed:
—
Similarly, you can filter the list to pages that share a common ancestor. For example, to show all incoming links from pages within our Macros section, use the following:
In the example above, only incoming links from pages attached to the Navigation and Lists page will be displayed:
—
Tip: You can also specify a space key if the page or ancestor is in another space, eg: MYSPACE:Page Title
Finally, you can limit the list to links coming from specific spaces, for example:
This will filter the links to our ADAPTAVIST space (our corporate website) where there aren't currently any links directly to this page (but should any appear in the future, you'll see them below):
None Yet
To filter by more than one space, simply separate the space keys by commas:
This will now include incoming links from the Builder User Guide and our Corporate Website:
Demonstration News
Excerpts
No self-respecting linking macro would be complete without the ability to display excerpts, and the {incoming-links} macro is no exception!
Excerpts are short summaries added to content (pages, news, etc.) using the excerpt macro and are useful for giving the user more information before they click a link.
To include excerpts, which are displayed in list mode, use the following:
Resulting in:
-
children macro — The {children} macro displays lists of child pages attached to the current page or orphan pages that are not attached to any page...
-
excerpt-include macro — The {excerpt-include} macro displays the an excerpt from another locaiton in your content...
-
excerpt macro — The {excerpt} macro defines a block of text as being the excerpt (or summary) for a page...
-
page-info macro — The {page-info} macro allows you to display several useful pieces of information about the page in a simple format
Hints and Tips
This macro is useful in navigation panels as it can show a list of highly relevant related content to the page being viewed, filtered if necessary to a specific part of your site.
Frequently Asked Questions
| Q |
How do you get those four dots as the custom separator? |
| A |
It's just two sets of colons ":" next to each other to give :: |
Issue Tracking
Adaptavist maintain a JIRA Project for tracking bug reports and feature requests for this macro. The currently reported items are shown below:
jiraissues: Could not download[ http://jira.adaptavist.com/secure/IssueNavigator.jspa?view=rss&pid=10038&component=10064&statusIds=1&statusIds=3&statusIds=4&statusIds=5&sorter/field=updated&sorter/order=DESC&tempMax=25&reset=true&decorator=none] : caused by : Circular redirect to 'http://jira.adaptavist.com:80/secure/IssueNavigator.jspa'
See Also
|
|
|
|
|
|
|
Is there an equivalent macro to display the outgoing links associated with a given page? I am thinking something similar to the Outgoing Links in the right panel of this page but, I have been unable to find the macro.
The "excerpt" parameter does not seem to work (see example 7 above). It shows the entire content of the page, instead of the information marked in excerpt tags.
Is it possible to filter the incoming links using a label on the linking page; e.g. only show incoming links where the page containing the link has the label "report"?
Not currently - the macro basically asks Confluence API for a list of links which may also include external referrers. As such I doubt it would be possible to use this macro in that scenario.
Thanks.