We have recently launched our new app Metadata for Confluence. In this blog post I would like to show you how you can display personalized metadata fields.
The app Metadata for Confluence enables you to structure and categorize Confluence systems. It also allows Confluence area administrators to set metadata fields and sets for each area. Depending on the template that the administrator has created, users can later add content to the site. The pages that have been filled with metadata can now be found and displayed through additional macros.
Let’s assume we would like to define a contact person for every page in your area. Area administrators can easily create new fields in the area administration. Name the first field “Contact Person”, so the person in charge can later add his/her name. If you would like to enable your employees to type in further information then create a second field named “Contact Person Message”, for instance.

However, you cannot use single metadata fields. You have to combine the fields into metadata sets in order to assign them to different pages or templates. For example, name your metadata set “Help Desk” and add the fields you have created. The metadata set is now defined as a standard set for all your pages within that area.

Every page that is added in that area will automatically contain the “Help Desk” set. Users can add and maintain the necessary information directly on the page just by using the metadata field.

In order to display the person in charge, we can create a user macro called “HelpDeskPanel”. Within this macro, we can use the assistant “metadataHelper”, offered by the app Metadata for Confluence. It helps you to display the designated person in charge and to integrate this in an appropriate way in HTML. For this we have rendered a macro panel and a macro profile and at the same time prepared an optional text template for the person in charge.
## @noparams #set($metadataField=$metadataHelper.loadMetadataFieldByKey("metadatafield.contact.person",$content.space)) #set($metadataValue=$metadataHelper.loadContentMetadataValue($content,$metadataField)) #set($user=$action.userAccessor.getUserIfAvailable($metadataValue)) <ac:structured-macro ac:name="panel"> <ac:parameter ac:name="title">Contact Person</ac:parameter> <ac:rich-text-body> #if($metadataValue && $metadataValue.trim() != "") <ac:structured-macro ac:name="profile"> <ac:parameter ac:name="user"><ri:user ri:userkey="$user.key" /></ac:parameter> </ac:structured-macro> #set($metadataFieldMessage=$metadataHelper.loadMetadataFieldByKey("metadatafield.contact.person.message",$content.space)) #set($metadataValueMessage=$metadataHelper.loadContentMetadataValue($content,$metadataFieldMessage)) <br> $!metadataValueMessage #else Please define a contact person #end </ac:rich-text-body> </ac:structured-macro>
If you incorporate it into a page then the person in charge will automatically be selected and presented.

Because the Metadata app allows complete access to the data for macro / user macro developers, this results in an almost endless amount of possible applications to structure your own Confluence more efficiently and to obtain information more quickly.