How to add a serial / issue number to a page in Confluence 4.0?

Robert Lauriston
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.
November 10, 2011

I want to build a simple knowledge base. How can I automatically add a unique ID number to each page name?

3 answers

1 accepted

0 votes
Answer accepted
David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 11, 2011

Browse to Confluence Admin | Look & Feel | Custom HTML

Paste this in At the end of the HEAD:

<script>
AJS.toInit(function(){
  if (AJS.params.pageId != 'undefined') {
    AJS.$('#title-text a').prepend(AJS.params.pageId + ' ');
  }
});
</script>

It will prepend the pageId to the page title.

Robert Lauriston
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.
November 11, 2011

Thanks! Is page layout development documented in any one place or will I have to piece it together myself?

<script>
AJS.toInit(function(){
  if (AJS.params.pageId != 'undefined') {
    AJS.$('#title-text a').prepend('KB-' + AJS.params.pageId +' ');
  }
});
</script>

Robert Lauriston
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.
November 13, 2011

That's close to what I need, except the number does not seem to be searchable.

2 votes
Fabian Lopez November 10, 2011

I faced the same problem while I was creating the KB and when we need to send a reference to the page that was not going to be changed (so I was not able to use the page name). The tiny url is the unique ID that I used.

I added the following on the top of the page just in case they need to send the link

Right-click this link and choose "Copy Link Location" to reference this KBA: {page-info:tinyurl}

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
November 10, 2011

Each page already has a unique page id assigned by Confluence. Would that work for you?

Robert Lauriston
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.
November 10, 2011

Yes, the unique page ID would be great. So I want to add something to the main-header div in the main layout for the KB space?

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
November 11, 2011

You have to figure out how you want it displayed but something like: PAGE_ID: ${page.id} in the layout.

Brent Lewis August 4, 2014

I am also interested in doing this, but my understanding is that the Page ID is not completely stable. The ID may chagne as updates are made to the page or if the Confluence instance is upgraded. Can anyone comment on how persistent page IDs really are on Confluence?

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
August 4, 2014

The pageId is stable, the page title can change (obviously).

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events