How to access an excerpt from child pages via forge, UI-Kit and the REST Api?

Fabian Schmitz January 10, 2023


We have one space where we document all or customer profiles.

We have one main page for each customer with a UI-Kit app/macro where we can easily see which Software-, Database- and OS-Versions are installed at the customer site. This app/macro is working as intended. This macro is placed inside an excerpt so it can be accessed from other pages.

I'm now in the process of writing an app/macro that will collect all the information of the child pages to display them on the overview page, so we can see all Names and Version-Info of the customers at a glance.

I already got all the child pages and display a list of the customer Names on the overview, but I can't find an easy way to get the excerpts. I can manually add the excerpt-include macro on the page itself and that works fine, but that does not help me with the automatically generated content.

I could not find anything about the excerpt in the references, guides or example apps.

What I could do is get the body of the page and extract the macro by going through all values in the atlas_doc_format but then I don't need to use an excerpt as I need to go through everything anyway.

Currently my code looks like this:

import ForgeUI, { render, Fragment, Macro, Text, Link, Strong, useProductContext, useAction, Heading } from "@forge/ui";
import api, { route } from "@forge/api"

// get child pages
const getContent = async (contentId) =>{
  const response = await api.asApp().requestConfluence(route`/wiki/rest/api/content/${contentId}/child/page?limit=50&expand=body,body.atlas_doc_format`)
    const err = `Error while getContent with contentId ${contentId}: ${response.status} ${response.statusText}`;
    throw new Error(err);

const result = await response.json();
  return result;

const App = () => {
  const { contentId } = useProductContext();

const [children] = useAction(
    () => null,

  const {results} = children;

// create the entries for all the child pages
  const renderPages = (results) => {
    return( => (
        <Text><Link appearance="link" href={`pages/${}`}>{entry.title}</Link></Text>
// show excerpt from childPage here:


  return (

export const run = render(
  <Macro app={<App />} />

All of the pages only have that one excerpt. And the excerpt has the same name in all pages.

We had the same feature as an user macro in the server environment and want to have the same feature in the cloud environment.

So my question is: Is there a way to excerpt-include from the code of a forge app and how would you do it?

0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events