Is it possible to retrieve the labels of one (1) particular page?
Say, I want to use the label(s) of a page as a value in a Page Properties key/value pair without having the editor putting that infomation in there manually (he only needs to add the label to the page).
Is this possible with standard Confluence functionality?
Well if by "standard" Confluence functionality, you include user macros, then yes. If you are comfortable with VTL and Java methods, the two you would need would be the getPage() and getLabels() (the last returns a collection).
Thanks Bill, this answers my question...
But I don't know how to write a user macro, so I guess there is no way of obtaining what I was asking for with my standard confluence configuration.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well there are guides, and samples out there. There is also a complex sample that deals with labels here:
https://github.com/unidwell/confluence-include-child-pages-macro
And yes there is a learning curve, but user macros allow you to fill in the holes in Confluence. And when I started, I knew nothing about VTL or Java. ;-) So it will take time to create this first macro, but the time will pay dividends later.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Bill Bailey for this insight ; I am a bit familiar with user macros, but not enough to write a full one from scratch ... Could you elaborate a bit more about how to use the getPage() and getLabels() functions?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you look at this code:
https://github.com/unidwell/confluence-include-child-pages-macro/blob/master/include_pages_macro.vm
You will see examples. The author first calls the needed functions:
#set( $pageManager=$containerContext.getComponent('pageManager') )
Now the methods can be accessed. So for example:
#set( $currentPage = $pageManager.getPage($content.id) )
Then you can do something like this
#set( $labels = currentPage.getLables( ))
Spend some time breaking down how the autor constructed the macro will help a lot in learning these tricks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Johan,
If you create a template and give it a label, any pages that are created using the template will automatically be created with that label.
Blue Prints and User created Templates
Victor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Victor,
thanks for the response, however, that is not the answer i'm seeking..
In fact, I want to know if it is possible, using standard Confluence functionality, to retrieve the label on a page automatically in a Page Properties field on that same page, so that i can report that label in the table that is automatically generated by a Page Properties Report macro.
I want to avoid that people need to add the label and secondly, the same label information in a properties field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.