Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Setup Confluence for unique URLs for each page

Sinclair April 17, 2018

I've got a lot of pages in development and page titles are changing on occasion.

Whenever I change a page name, any links to that page break.

This is because Confluence is set up to append the Page Title to the URL. I change the title, the URL breaks.

What I want is to have the system set up so all pages get a unique URL, not related to the page title.

1 answer

1 accepted

0 votes
Answer accepted
Daniel Eads {unmonitored account}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 17, 2018

You can use the tiny URL in the Share menu for this purpose - it's static! The tiny URL is based on the page id. This doesn't change even if the page title changes.

image.png

Clicking the Share button in the upper right on the view screen will bring up the dialogue, or you can use the keyboard shortcut on the view page.

Cheers,
Daniel

Sinclair April 17, 2018

Thanks Daniel.

That's a good start but means I have to open every single page to get the TinyUrl link.

It's quicker to right-click the item in the tree, but again, I'm asking for a URL that doesn't include the page title; a unique identifier.

Any other ideas?

Daniel Eads {unmonitored account}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 17, 2018

Curious on what the use case is where copying a few tiny URLs would not suffice... Confluence will keep its own internal links up to date provided you are using the [page title] style linking are not pasting raw URLs back in to Confluence.

At any rate, this is a User Macro that will print the entire page tree for a space and provide hyperlinks using page id instead of page title. The tiny URL for multiple pages doesn't seem readily available to user macros, so you'll have to excuse the extra URL length. You can right-click to get the id-based link from the output of the macro.

## @param SpaceKey:title=Space Key|type=string
#set ( $spaceToDisplay = "" )
#set ( $spaceToDisplay = $spaceManager.getSpace($paramSpaceKey) )
#if ( !$paramSpaceKey )
#set ( $spaceToDisplay = $space )
#end
#if ( $spaceToDisplay == "" )
<p> Space with key "$paramSpaceKey" not found. </p>
#else
<p> Pages in space $spaceToDisplay.key </p>
#set ( $topLevelPages = $pageManager.getTopLevelPages($spaceToDisplay) )
<div>
<ul>
#foreach ( $topLevelPage in $topLevelPages )
<li>
<a href="${req.contextPath}/pages/viewpage.action?pageId=$topLevelPage.id"> $topLevelPage.title </a>
</li>
#parseChildren($topLevelPage)
#end
</ul>
</div>
#end
#macro(parseChildren $pageToParse)
#set ( $pageChildren = $pageToParse.getChildren() )
#if ( $pageChildren != "[]" )
<ul>
#foreach($childPage in $pageChildren)
<li>
<a href="${req.contextPath}/pages/viewpage.action?pageId=$childPage.id"> $childPage.title </a>
</li>
#parseChildren($childPage)
#end
</ul>
#end
#end
Sinclair April 17, 2018

Hi Daniel,

 

Going to have to put this down to User Education Required (AKA PEBKAC). 

Straight paste of link actually does update if page title changes.

Apologies and thanks for suggestions.

L.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events