get space description with a user macro

shoshana_uzan May 23, 2023

Hi,


I want to display the description of the space on the confluence page and I wrote the following code in user macro

#** ---------------------------------------------------- ----------------------------
PROCESS INPUT
*#
#set($permArray = [])
#if (!$paramSpaceKey)
#set($paramSpaceKey = $space.key)
#end
#set($forspace = $spaceManager.getSpace($paramSpaceKey))
#set($spacename = $forspace.getName())
#set($spacedesc = $forspace.getDescription())

$spacename

$spacedesc

------------------------

 

But I don't get the description of the space

Note:
I mean the description that appears in :

space Tools->overview->space details ->Description

advice on how to this ?

Thanks

Shoshana Uzan

 

2 answers

0 votes
Onik Rozg
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 25, 2023

Found it in the default velocity templates:

$forspace.getDescription().getBodyContent().getBody()

Or with the velocity property shorthands:

$forspace.description.bodyContent.body
0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 24, 2023

Hi @shoshana_uzan ,

based on API https://docs.atlassian.com/ConfluenceServer/javadoc/7.1.0/com/atlassian/confluence/spaces/Space.html getDescription return a SpaceDescription object (https://docs.atlassian.com/ConfluenceServer/javadoc/7.1.0/com/atlassian/confluence/spaces/SpaceDescription.html). Try to use : 

#set($spacedesc = $forspace.getDescription().getDisplayTitle())

Fabio

shoshana_uzan May 24, 2023

Hi,

Thanks
But when I try it I get the name of the space and not the description
You have an idea?

 

ShoshI

Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 24, 2023

hey @shoshana_uzan , I don't find any method for that in the API

shoshana_uzan May 24, 2023

Thanks

It seems logical that $forspace.getDescription()) will return the value of the description, but it returns something else that I have no idea what it is...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events