Creating navigation links for parent/child pages

I'm currently trying to reorganise a number of pages into a usable documentation that can be easily navigated by adding a set a links to the end of each page that contains "prev home/up next" which will link to the appropriate page in each case.

i.e. if I have the following set of pages

  • Overview
    • Sub Topic 1
      • Child page 1
      • Child page 2
      • Child page 3
    • Sub Topic 2
      • Child page 1
      • Child page 2
      • Child page 3

When viewing child page 2, I would like to create links at the bottom of the page to point to "child page 1 Sub topic 1/Overview child page 3"

Rather than hardcode these and then have re-edit them each time I move pages around or add in new pages, I was hoping that someone could suggest how to use the {report-xxx} macros correctly to achieve this? I think it's a lack of understanding how the 'prefix:key' works is what is catching me out in most cases.

What I'm looking to add to each page is something similar to what can be seen on the following page with confluence updating the links automatically as new pages are added:

http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Installation_Guide/s1-archinfo.html

2 answers

1 accepted

0 votes
Accepted answer

Would the Navigation Plugin work for you?

https://plugins.atlassian.com/plugin/details/170

Very close, if it could retrieve child pages using the key page:sorted children it would do what I want, unfortunately it sorts by alphanumeric. Think I'll have to change how I'm naming the pages to get this idea to work. Shame as it would have been very useful to be able to reorganise documentation by simply changing the order of the pages without needing to edit each page.

Just to be sure, I'll start by saying perhaps what you consider hardcoded is actually soft coded. When you move pages around, the name of the page in a [ ] link will still find the page.

You may be saying you have some hierarchy (family) of pages which is dynamic, but you want a to present links to each node in the hierarchy. Assuming Overview remains the root of the tree, you can use some simple solutions:

{pagetree:root=Overview}

or

{children:page=Overview|all=true}

If you really want to use the reporting plug-in, I am not sure how to get a hierarchically organized tree from it. Here is the basic list of all descendants:

{report-table}

{content-reporter:space=@self|types=+page|scope=SVN > descendents}

{content-reporter}

{report-column:title=Title}{report-info:page:title|link=true}{report-column}

{report-table}

An alternative for you is to create the page tree map manually on another table of contents page and then {include} that page on each of your family pages. That would actually free you from having to worry about having the pages organized in a certain way.

True hardcode may not have the right meaning, but it's the difference between identifying the page to which the link should always point too and having confluence dynamically determine what it should point to based on where it lies relative to other pages.

I'm already using the {children:depth=1} on the sub-topic pages, and that works pretty well for vertical lists.

What I'm looking to add to each page is something similar to what can be seen on the following page:

http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Installation_Guide/s1-archinfo.html

Where if new pages are inserted between "child page 2" and "child page 3" the wiki macros produced links that are correctly updated to point the next link on "child page 2" and the prev link on "child page 3" to the new page in sequence.

To do what I'm looking at, on "child page 2" in my layout above I need some why to pick out the sibling pages currently organised before and after the current page, but use of {report-xxx} appear to order the results differently to the manual order you can impose on child pages.

The output from the following 2 snippets does not result in the same ordering, even though they have the same content:

{children:depth=1}

{report-list:depth=0}
{content-reporter:space=@self|types=+page|scope=@self > children}
{content-reporter}
{report-body}{report-info:page:title|link=true}{report-body}
{report-list}

If it's not possible, I can add in links using the standard format and update them as changes are made, it would just be nice to have it work without needing any maintainence.

If you are able to alphabetically name your pages in the child 1, 2, 3 order, you can add a {text-sort} to the content reporter output. Let me know if you need an example of that syntax.

Another possible option for you is to organize the ordered set of children pages as a linear tree organization where each next child is the only child of the current child. Then your prev and next hyperlinks can be driven by the reporter macros giving parent and child. Up/Home can be fixed links. Use {link-to:@parent}Prev{link-to}.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in New to Confluence

How to use Confluence Cloud for stakeholder management

Most of us don’t need much convincing that stakeholder management is important. It just makes sense that keeping everyone in-the-know on projects and assigning clearly defined roles is key to having ...

1,187 views 4 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you