---
title: "set-metadata macro"
canonical: "https://support.appfire.com/space/CDML/650251172/set-metadata%20macro"
format: markdown
---
> Macro (aura-html)


## Overview

> Macro (excerpt)
> 
> Define metadata properties - metadata name and value

The **set-metadata** macro is used to define **metadata key=value** pairs stored at the content level (page or blog post).

The values can later be retrieved using the [get-metadata macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649826804), or any other third-party app capable of reading metadata.

In addition, the values can be used as [value references](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694302) in any macro or feature that supports them.

## Where to use it?

Optional.

One or more **set-metadata** macros can be used in a [workflow trigger macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649859133).

## Parameters

| **Parameters** | **Required** | **Default** | **Notes** |
| --- | --- | --- | --- |
| *first unnamed*  
*parameter* | :check_mark: |  | The metadata key (name by which the value can be accessed).<br>- Check [character restrictions](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649859070) |
| *macro body* |  |  | The metadata value<br>- Check [character restrictions](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649859070)
- Supports [value references](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694302) |
| `trim` |  | `true` | Should the *macro body* contents be trimmed (remove whitespace)?<br>- `true` – yes, trim (recommended)
- `false` – no, leave as is |
| `page` |  | *current page* | Where should the metadata be stored (default = *current page*)?<br>- `@parent` – store on the parent page, not the current page
- `@children` – store on child pages, not the current page<br>> 📝 This parameter only works on pages. It does not work for blog posts. |

## Basic trigger example

```plaintext
{workflow:name=Store metadata}
   {state:Test}
   {state}
   {trigger:pagecreated}
      {set-metadata:Document Author}
         @user@
      {set-metadata}
   {trigger}
{workflow}
```

> 📝 For a trigger using the **pagecreated **event to work, the workflow must be [applied as a space workflow](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649531846).

## ...retrieving later

You can either:

- Use the [get-metadata macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649826804), for example, by adding the get-metadata macro directly to the page, or in a page properties macro:

![pagepropertiesmacro_get-metadatamacro_docuemntauthor_metadta_value.png](media://cb290f1a-2495-4ab3-ab7f-7f4f0dd2729a)

- Retrieve it as a [value reference](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649957347), in any workflow macro or third-party app that supports value references

## <span style="color: #ffffff">0</span>.. using Confluence Search

<span style="color: #172b4d">Metadata values created with the </span><span style="color: #172b4d">**set-metadata**</span><span style="color: #172b4d"> macro are only indexed by Confluence and appear in the Confluence search if the </span>[Appfire Comala Metadata app](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649956848) <span style="color: #172b4d">is installed.</span>

## Examples

> Macro (contentbylabel)

## Related pages

- [https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694302](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694302)
- [https://appfire.atlassian.net/wiki/spaces/CDML/pages/649925583](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649925583)
- [https://appfire.atlassian.net/wiki/spaces/CDML/pages/649563178](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649563178)
- [https://appfire.atlassian.net/wiki/spaces/CDML/pages/649956848](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649956848)