Confluence link to the current page

For my current Confluence project, I’ve used Adaptavist Theme Builder to customise the View/Upload Attachments screen and I wanted to add an explicit link “back” to make it easier for users to return to the current page. I could have used Javascript, and so much of Confluence depends on client side scripting that it probably wouldn’t have been a problem… but I do like being POSH, so I wanted to keep it simple and just have a regular HTML link.

Update: As Guy from Adaptavist suggests below, the simplest way of doing this (if you have the excellent Adaptavist Theme Builder plugin, is to use:
{menulink:pageView}click me to visit the current page{menulink}

Confluence has an active and generous development community, providing lots of free macros to add all sorts of content and functionality into your wiki. Unsurprisingly, there isn’t an abundance of macros to link to the current page – ordinarily, why would you want to? Building on my recent experience with User Macros, I felt sure there was an easy way of doing this, and so I present the macro code to create a link to the current page:

<a href="$content.getUrlPath()">$param0</a>

Paste the above code into a user macro, and call it something like “current_content_link”, you can then use it as follows:

{current_content_link:click me to visit the current page}

Which will generate a link with the text “click me to visit the current page” (as you’d expect).

Join the Conversation

3 Comments

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.