Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How do you write a power script to show metadata about all the pages in a space?

Looking for help with writing a macro to audit the pages within a space in a Confluence instance, showing the following fields: 

  • Page name
  • Link to page
  • Last updated/modified date
  • Original Poster (creator) 

Previous implementation was deployed on a created page within the space being audited, and showed a table of all the pages within the space. 

2 answers

1 accepted

0 votes
Answer accepted
Dave Liao
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 14, 2023

@Michael Zhao - hi Michael!

Are you actually looking for a Power Scripts for Confluence script?*

If no, or  it's not imperative that we use PS, consider a custom user macro:

  1. See this example: https://community.atlassian.com/t5/Confluence-questions/Macro-that-lists-all-pages-for-the-specified-space-with-their/qaq-p/1452170
  2. ...and consider THIS example if you want to extend the first example: https://community.atlassian.com/t5/Confluence-articles/A-Child-Page-by-Label-User-Macro/ba-p/1502246

* today I learned that PS for Confluence is a thing! Awesome.

Definitely looks like it matches what I'm looking for. Talked to a former colleague who mentioned the previous iteration was built with Power Scripts, but more looking for a starting point to build it out in a different organizational context, so not a requirement.

 

Thanks again!

Like Dave Liao likes this
Dave Liao
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 14, 2023

@Michael Zhao - FYI if you have an existing PS script, you may be able to extend it using these variables: https://appfire.atlassian.net/wiki/spaces/PSCONF/pages/15306098/Standard+Variables

Hi @Dave Liao 

In case you are using Cloud

It might also be worth to take a look into our (Wombats Corp) app User Macro for Confluence Cloud

You can create numerous dynamic macros from the admin panel.

For your exact use case template would be the following:

{{#set name="spaceId"}}

  {{space.id}}

{{/set}}

<table class="aui aui-table-list aui-table-sortable">

    <thead>

        <tr>

            <th id="column-name">Page Name</th>

            <th id="column-link">Link to Page</th>

            <th id="column-updated">Last Last Update</th>

            <th id="column-creator">Original Poster</th>

        </tr>

    </thead>

    <tbody>

    {{#getPagesInSpace id=spaceId limit=250}}

        {{#each results}}

        {{#set name="url"}}https://wombats.atlassian.net/wiki{{_links.tinyui}}{{/set}}

        <tr>

            <td>{{title}}</td>

            <td><a href="{{url}}">{{url}}</a></td>

            <td>{{version.createdAt}}</td>

            <td>{{#getUser accountId=authorId}}

                {{publicName}}

            {{/getUser}}</td>

        </tr>

        {{/each}}

    {{/getPagesInSpace}}

    </tbody>

</table>

The result would be like this:
Show metadata about all the pages in a space.png

Regards, Roman

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events