My goal is to create a default page title for a specific template (kind of like the Meeting Notes template). I want to have the template type, page ID, and the title the user inputs.
So when a user creates a page using this specific template, the title should have: SPC-#### user input title
Note: The #### should be automatically generated once user creates the page.
What's the simplest way to achieve this? Also, what permissions would I need to have (Confluence admin or space admin)?
I was following a couple other discussions/questions regarding a default title but some suggested creating a custom blueprint and others said to change the custom HTML.
It's simply not possible out of the box. That's the easy answer. You need custom code of some variety to achieve this. Are you willing to write scripts or code of some type?
Are you on Confluence Cloud or Confluence Server. That will also dramatically change my answer.
I couldn't pull the pageId either, I have a feeling its because it doesn't exist until the page is saved. We used to get pageId from the UI by checking the URL when in edit mode - Since Confluence 6, there is a draft ID in the URL and you have to go to Page Information and look at the URL for the page ID.
You cannot search for the page based on the pageId in the search bar but you can find it using CQL with a REST URL like:
Here are the available fields:
I am getting really curious about your use case - why do you need to search by page ID?
Hmm I will try it out. Just curious, would working with blueprints/creating my own blueprint be a possible solution to get the page ID in the title?
I'm using page ID because it's a unique number for each page and it's autogenerated. Ideally, what I want is to have every document have a prefix (i.e. SPC for specifications document), a unique number (page ID), and a page title. Like this:
SPC-1234 Page Title OR
SPC Page Title ID:1234
Because the ID is a unique number for each document, searching for that document would be optimal. If there was another way to autogenerate a unique number for each document, I would be open to trying that.
Thank you so much for your help!
If you are writing your own blueprint you have full control over the title by providing a context provider.
you have access to the blueprint context which contains the title.
BlueprintContext updateBlueprintContext(BlueprintContext blueprintContext)
This works per blueprint since you assign each blueprint its context provider. So to my knowledge you cannot contribute to an existing blueprint.
This enum lists common keys:
Note that there is a key NO_PAGE_TITLE_PREFIX which deals with making titles unique by prefixing it. I haven't used it in my blueprints.
So I extended AbstractBlueprintContextProvider and modified the updateBlueprintContext method and was able to add a String prefix. The String I input is automatically added to the title, which is good. But how would I pull the Page ID so that it can be added to the title?
You could probably have your own counter (for instance in an AO table or with Bandana) which would make you independent of the page ID. Or you could use the parent page ID and add some number to it (like "-123" for the # child - use the Page Manager to check if the title already exists).
You could also listen to the page creation event and adjust the title then, but this seems a bit like a hack ...
Hope this helps ...
Take our 5-minute survey to win a $500 Visa gift card! Are you currently using Confluence Cloud? We want to hear from you! Fill out this quick survey about your Confluence Cloud experience so we ...
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