---
title: "space-hierarchy macro"
canonical: "https://support.appfire.com/space/COMALACM/655759770/space-hierarchy%20macro"
format: markdown
---
> Macro (aura-html)

## <span style="color: #091e42">Overview</span>

<span style="color: #091e42">The </span>`space-hierarchy`<span style="color: #091e42"> macro</span><span style="color: #333333"> displays on the page the hierarchy beneath the current space. It is displayed as a tree representation of the hierarchy.</span>

![image](media://4a1a7953-6316-4b4e-8b03-0faa3e3943bd)

> ℹ️ The space hierarchy is defined using the `parent-space` macro added to each child space.

<span style="color: #333333">You can show the hierarchy beneath a different space using the </span>`space`<span style="color: #333333"> argument.</span>

## Parameters

| **Parameter** | **Required** | **Default** | **Notes** |
| --- | --- | --- | --- |
| `space` |  | Current space | Sets the space to use as the root space for the hierarchical display<br>- Value can be the **spacekey** or  **~<*****spacename>***<br>> ℹ️ The hierarchical root space is displayed as the root space in the tree representation on the page. |

## Usage

Add the **Space Hierarchy** macro to a page in a space using the Confluence macro browser.

![image](media://75bf25fb-7ed5-4856-8da8-9a0525d6fd00)

In the macro editor preview, any spaces set as a child of the root space using the `parent-space` macro. It is displayed in the tree representation.

![image](media://c1c89253-8d0d-48fa-b538-828a505391e0)

If the **Space key** box is left blank, the current space is displayed as the root space. In our example, this is the **Human Resources** space.

If required, add the **spacekey** to set the root space for the tree representation.

## Reference markup

```
{space-hierarchy:space=tdt}
```

Where the `space` parameter value defines the root space for the tree representation. 

## Related macros

> Macro (contentbylabel)

## Related pages

- [Adding metadata to a space](https://appfire.atlassian.net/wiki/spaces/COMALACM/pages/655988362)
- [Setting up hierarchical spaces](https://appfire.atlassian.net/wiki/spaces/COMALACM/pages/656676531)
- [Using metadata to define space hierarchies](https://appfire.atlassian.net/wiki/spaces/COMALACM/pages/656578613)