How you can read the page properties with a custom macro?

This question is in reference to Atlassian Documentation: Page Properties Macro

I would like to read the page properties and display the result in a custom layout.

I know the Free Plugin "GetMetadata" from Comala but with this plugin I can't read metadata in another page...

Can you help me?

Thank you!

4 answers

0 votes
Bill Bailey Community Champion Jul 30, 2016

I think it is of the form: $pageProperty.from("User") where User is the key. And $pageProperty.from("User", "123") when you have macros with IDs.

How to access from another page, I am not clear on, but maybe this gets you started and you can report back?


I tried  $pageProperty.from("Field1") in a page with a property "Field1" but It doesn't work...

Where did you find the name of this calss? I didn't find it in the

My macro is:


## Developed by:  <your name>
## Date created: 27/07/2016

## @param filter:title=Filter|type=string|required=false|desc=Label filter



0 votes
Steven Behnke Community Champion Jul 31, 2016

It is not possible to lift the content of the 'page properties macro' directly. I'd like explain the difference between some things here – 

  • The question is pertaining to the Page Properties Macro, which is a page macro inserted into a page. A while in the past, this macro was called the Metadata Macro. It is called {details} in the storage format. Again, this has no direct API.
  • Bill Bailey is referring to the storage mechanism Properties, which can be applied to various content types in Confluence via the public APIs.


I believe the Page Properties Report macro searches for pages with the correct labels on them, parses the page content for the Page Properties Macros, and then pulls the interior <table> element for reporting. You would have to do the same to obtain the data inside the macro.

Steven Behnke Community Champion Jul 31, 2016

The JAVA API I am sure would be preferable due to speed. You could use the REST API to use a CQL query like such –

"You would have to do the same to obtain the data inside the macro."

Yes...And How I do that? I need to do that, i woluld like a custom layout.

Thank you

Bill Bailey Community Champion Aug 01, 2016

If you want to display data on the same page it is stored, the only solution I know of (and have used) is via the metadata plugin.Since it is free (and has been for years), that is the best/easiest solution.

Where I got the syntax was from here:

But even if that method is available, I typically have based variables using the metadata plugin.

Like 1 person likes this

Hello Bill,

To use page properties as placeholders:

  1. Open the root page of your exports.
  2. Insert a page properties macro to your page and a two-column key-value table.
    information The first column of the table will be the keys and the second one will be the corresponding values.
  3. Save the page.
  4. Open your template and insert the placeholder in the following pattern:$pageProperty.from("User")
    information Please note that the placeholders are case-sensitive.
    This placeholder will be replaced with the corresponding value stored in the content properties macro for the key with name "User".

  5. If you have multiple page property macros on your root page, you have to assign an ID to the macros and refer to this ID in your template.
    For example:$pageProperty.from("User", "123")
    This placeholder will be replaced with the corresponding value stored in the content properties macro with ID 123.


Step 1 : OK

Step 2 : OK

Step 3 : OK

Step 4 : ??? I need more explanation... 

Step 5 : OK

Bill Bailey Community Champion Aug 01, 2016

This is in reference to K15t velocity templates, but could give you a clue of how to address them (I haven't tried this). I am assuming that it will display the value on the page.

From the metadata plugin, there is the following method:

getMetadataValues(String token, String spaceKey, String pageName)



So... How I can use it?

In a macro like this?

<ac:structured-macro ac:macro-id="5b3f7bcc-12c8-4b82-afd6-93e41192cfb5" ac:name="metadata-values" ac:schema-version="1">
<ac:parameter ac:name="0">Source</ac:parameter>
<ac:parameter ac:name="1">SGDE</ac:parameter>
<ac:parameter ac:name="2">SYS-0004</ac:parameter>


  1. Source is the key
  2. SGDE is the space name
  3. SYS-0004 is the page name


This macro doesn't work...

Does anyone have an example of a PagePropertyExtractor class in Java that can read the page properties from the page body?


I want to build a simple search with which I can filter for the page properties. Now it would only work afterwards. That means, I search for pages by title and filter the result by the specified page properties.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

711 views 2 13
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you