Add link to navigate to parent page

Is there a (easy) way to add a link to the current parent page that will continue to work after pages are rearranged in the hierarchy? I'm not sure we will be able to install a plugin. If we do install a plugin, it has to be rock solid.

Example: (Read ~ as whitespace)

A (parent of B)
|
+-- B (parent of CD)
~~~|
~~~+-- C (Child of B)
~~~+-- D (Child of B)

B has a link that navigates to A

CD have links that navigate to B

Then change happens, and the tree is re-organized to look like this:

A (parent of D)
|
+-- D (parent of BC)
~~~|
~~~+-- B (Child of D)
~~~+-- C (Child of D)

Now, without having to edit the pages...

BC's link navigate to D

D's link navigates to A

4 answers

1 accepted

Hello Brian,

You can use the Documentation theme to embed a page three macro on the left hand side of each page.

https://confluence.atlassian.com/display/DOC/Configuring+the+Documentation+Theme

This will give you a full page tree rendered on each of the pages of a space. It will include links to all descendants from the root of the space much in the matter you outline above.

Please let us know if that works for you.

I had forgotten about the docuemntation theme. While the space I'm using has the documentation theme on, it is too cluttered making it awkward to navigate. I may end up moving my pages to a new space since they are designed as a documentation collection.

Brain,

Pushing this idea a bit furhter I created the following feature request.

https://jira.atlassian.com/browse/CONF-27737

Supporting links to @<locations> may be a way to get the functionality you are looking for without the extra bulk of the documentation theme. If you think it is a good idea please give it a vote up in the upper right hand corner.

Here is our solution. I will always display the name of the parent page and make it clickable. It will dynamically change no matter where you move the page to updating the parent link appropriately.

You'll need these macros:

  1. Click Edit on the page you wish to add the link
  2. Click Insert -> Wiki Markup
  3. Insert some dummy wiki tags like {bogus}{bogus}
  4. Click Insert
  5. In the Wiki Markup panel remove the bogus tags
  6. Insert the following wiki markup
{link-to:@parent}
{page-info:title|page=@parent}
{link-to}

I was using the solution provided by Richard for a while, but unfortunately the page information tools hasn't been updated for the newest version of Confluence (not to mention that Confluence tries to update any wiki markup whenever it gets a chance).

After searching a bit, I finally found that you can make a simple user macro that will provide the same functionality.

## @noparams
#contentLink2($content.getParent() false false)

Add a user macro, choose a name and title (I used linktoparent and "Link to Parent") and leave the rest of the options at the default values. Copy and paste these two lines into the macro body field and save, and it should work.

This works really well but is only 99% complete. I've updated this with the following code instead: ## @noparams #if (!$content.getParent()) <b>No parent page found</b> #else #contentLink2($content.getParent() false false) #end

@David Grierson thanks a lot, you've just saved an hour of research for a single person, thousand hours for thousands of seekers!

@David Grierson. I concur, thank you for this. Exactly what I was looking for. 

The Reporting plugin would be one option here. It brings an "awareness" to the situation, so for instance, you could define a link on the current page which points at the parent page. This is not hard coded though, so if the page moves, then the link will point to the new parent.

{report-link:content:parent &gt; content:url|default=_This page has no parent._}View parent page{report-link}

More info here: http://wiki.customware.net/repository/display/REPORT/report-link

I can recommend this plugin. It is a commercial one, but the license cost is reasonable in my view.

An alternative approach could be to write a user macro, as I think the Confluence objects available in Velocity (user macro language) will allow you to identify the parent of the current page, and so create suitable links.

Charles--thanks for the pointer. I like the capability of the reporting plugin. I wish we had it!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,768 views 26 10
Join discussion

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