Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is it possible to generate a page id

Hi all,

We use Confluence also as a Knowledgebase and what we would like to do is generate a unique page id. Does anybody know of such a solution?

Thanks,

Bruce

2 answers

1 accepted

I think this is really a duplicate of How to add a serial / issue number to a page in Confluence 4.0?

My answer to that likely holds up still:

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.

You are right, this is a duplicate and your solution is close to what we are looking for. Actually we are running into the same problems as the id will not be printed when doing a PDF export and that it is not searchable. Do you have any ideas on this?

Either create a user macro with the following content:

$content.id

...then add the user macro to the page.

Or add the above to an appropriate place in the PDF template.

See: http://confluence.atlassian.com/display/DOC/Providing+PDF+Versions+of+your+Technical+Documentation

Thanks a lot for your assistance. I managed to write tha user macro and it works fine if I add it to a page, but I am somewhat not able to get it into the PDF export. What I did is added following lines to the CSS

  1. @page
  2. {
  3. size: 210mm 297mm;
  4. margin-top: 1.4cm;
  5. margin-bottom:1.4cm;
  6. margin-left: 1cm;
  7. margin-right: 1cm;
  8. padding: 1em;
  9. @top-left;
  10. {
  11. content: $pageid;
  12. font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
  13. font-size: 6pt;
  14. }
  15. }

The name of the macro is pageid. Could anybody please tell me where I am going wrong? I read through the documentation without finding a hint how to add the macros. Or am I running into the item CONF-16733?

I copied and pasted this code in the HTML editor but nothing happens, 

do i need to change the information in the green quotes?

@Anthony_Aquilina

You cant try Linking add-on and use the macro add page on wich you specify an increment ID code using confluence source editor plugin, it's free.

In the edit page add this code:

<p>
<ac:structured-macro ac:macro-id="fb457b05-9bf7-417f-8898-25505debe433" ac:name="add-page" ac:schema-version="1">
<ac:parameter ac:name="prefix"> %child-counter:next%</ac:parameter>
<ac:parameter ac:name="linkText">Add New Page</ac:parameter>
<ac:parameter ac:name="source">[Your Template name here if you have]</ac:parameter>
</ac:structured-macro>
</p>

Hallo Bruce,

Each page in Confluence does have unique page ID. Would you be able to use the ID that Confluence generates? To see the ID of a page, view the "Information" screen for the page then look in the URL. For example, in this URL:

http://confluence.atlassian.com/pages/viewinfo.action?pageId=135922

The page ID is "135922".

You can view the page by ID, using this URL format:

confluence.atlassian.com/pages/viewpage.action?pageId=135922

And edit it too, provided you have the right permissions:

http://confluence.atlassian.com/pages/editpage.action?pageId=135922

Does that answer the question?

Cheers, Sarah

Hi Sarah,

that is not quite what we are looking for. But it would suffice if this id could be added to the page by a macro, so that if the title changes you still find the page by this id. Is there a possibilty to do so and if yes, can the existing pages be updated automatically so that these pages also contain the id?

Thanks, Bruce

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

454 views 24 9
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you