SINCE VERSION 3.0
There are several macros you can use to display metadata in Confluence or to select pages on the basis of their metadata. This page will show you how to use the Content by Metadata macro.
Introduction
The Content by Metadata macro is used to display the page metadata of multiple pages in a list according to a search criterion.
An example result can be seen in this preview:
Image 1: Content by Metadata Macro (click to enlarge)
The search criterion is defined by filtering for metadata fields and certain values of those fields or metadata sets. Details on using the CQL dropdown filters are described in Searching with Metadata (v 3.0) and the next section.
If you want to search for more detailed information, open the expert filter criteria by clicking "Show". This will allow you to, among other things, filter for metadata sets, filter for Confluence spaces or create more complex search queries using Lucene search. Find detailed instructions on how to generate these queries in Searching with Metadata (v 3.0) and some additional information in the next section.
The Metadata Overview will then only show search results that match the expert filter criteria AND selected filters.
You can find more detailed information on the available parameters in the next section.
Parameters
The following parameters are available for the Content by Metadata macro. To display all of the parameters, click "Show" next to the heading "Options".
Parameter | Default | Description |
---|
Filters | None | Optional | Define metadata fields and metadata field values, and metadata sets to filter results displayed in the metadata overview macro. Can be left empty if expert filter criteria is used (see next parameter). |
Expert filter criteria | None | Optional | Define more comprehensive filter queries to filter results displayed in the Content by Metadata macro. Can be left empty if filters are used (see prior parameter). Expert filter criteria are defined using the metadata sets and field keys and Confluence Query Language (CQL). Have a look at Searching with Metadata (v 3.0) for further details. Placeholders are supported to make the output of the macro more dynamic. The following parameters are available: - The current page object by using the placeholder $content
- The current user object by using the placeholder $user
- The value of a certain field of the user's profile by using the placeholder upc.currentUser.<FIELDNAME>. This parameter works for all field types except multiselect and the About me field. The add-on User Profiles for Confluence needs to be installed.
|
Sort by
| Page title ("title") | Optional | Defines the metadata field whose values will determine the sort order of all entries. |
Sort Direction | ASCENDING | Optional | Defines the sort direction of the table entries according to the values entered in the "Sort by column" column. |
Number of items to display | 20 | Optional | Defines the maximum amount of pages that are to be displayed in the macro. If the filter results contain more items, the output will be cut off. The parameter "Show more results" can be set (see below). The maximum supported number is 250 items. |
Show key of space | Unchecked | Optional | Show the space key of the space where the page is located. It will be displayed in brackets behind the title. |
Show more results | Unchecked | Optional | Displays a "load more" link at the bottom of the list. |
Permissions
The search results are filtered according to the permissions of the logged-in user. This means that you will only see pages you are allowed to access in the Content by Metadata macro.
If the page or space is not otherwise restricted, pages that can be accessed anonymously will appear for anonymous users.
Use Cases for Expert Filter Criteria
1) Example from the Metadata demonstration space "Product Directory" - show all pages with the metadata set "Product Info" (metadata set key "democaseproductinfo"), which are part of the space "Product Directory" (space key "DEMOCASEPRODDIR"):
metadataset:metadataset.democaseproductinfo AND spacekey:DEMOCASEPRODDIR
2) Personalization of Confluence content with the help of User Profiles for Confluence - show an overview of all pages with the metadata set "Product Info" where the metadata field "Technology" equals the content of the user profile field "Technology" of the current user:
metadataset:metadataset.productinfo AND metadatafield.technology:upc.currentUser.Technology
For further explanations of this use case, please see How to Get Started. Available options for placeholders are described in the section Parameters above.
You can find further details on basic and complex search queries as well as determining the correct field or set keys in Searching with Metadata (v 3.0).
Back to Top