Forums

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

pageid vs page name

Ross Ursula October 1, 2020

Created  pages sometimes show in the browsers url at the and the pageid, somtimes the page name.

Why is there a difference and how can I have influence on that?

2 answers

1 accepted

2 votes
Answer accepted
Aron Gombas _Midori_
Community Champion
October 2, 2020

As far as I know, it depends on whether the page name can be safely encoded in the URL.

For instance, if the page name uses Latin characters only and it is relatively short, it is safe and readable in the URL, so Confluence prefers that. But if it is very long or if it uses "more exotic" characters, the URL would become ugly, and Confluence decides to identify the page by its ID.

It is a convention that has been in place since very-very old Confluence versions.

(You can always use the ID in the URL, even when Confluence prefers the name.)

Ross Ursula October 7, 2020

Thank you Aron, that was very helpful!

Can you tell me how I always get the ID in the URL, even when Confluence prefers the name? I can see the ID when I go to "View Storage Format" but I don´t get the document to be saved  with the ID in the URL. 

Aron Gombas _Midori_
Community Champion
October 7, 2020

Ross, I went as far as I looked this up in the Confluence code.

Please see the comment about the logic that chooses between name-based and ID-based URLs:

public static String getPageUrl(AbstractPage page) {
if (page == null || (page.isLatestVersion() && page.getSpace() == null))
return "";

String title = page.getTitle();

// only use simple/nice page url if the page does not contain:
// - non-ASCII characters
// - '+' or '-' characters because these can be picked up by the insert and stripe through filters
// - double quotes (") because orion doesn't play nicely with them (CONF-1287)
// - ends in punctuation (CONFDEV-3995)
if (isSafeTitleForUrl(title) && page.isLatestVersion())
return toDisplayUrl(page);
else
return getIdBasedPageUrl(page);
}
Like # people like this
1 vote
Niranjan
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.
October 1, 2020

@Ross Ursula - Page IDs do not change whereas page names can be changed. Page name works fine for searches. I am unsure of your use case, but if it is about automation, you can prefer page ids for page references.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events