Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,293,676
Community Members
 
Community Events
165
Community Groups

User Macro to Get a count of likes or comments on a page?

Hello, 

 

Can anyone help with custom macro to display number of likes (or comments) on a page?

 

I'm trying to populate "page properties report" but build in likes/comments count functionality has a bug and column headers don't display likes/comments.

 

So i'm building out template for "page properties" macro to capture the data and than pull it on higher up report page. 

 

Thanks in Advance!

1 answer

1 accepted

0 votes
Answer accepted
Dominic Lagger Community Leader Aug 24, 2021

Hi @Alex Kulichkov 

I only get the answer for the comments:

#set( $page = $pageManager.getPage($content.getId()) )
Comments: $page.getComments().size()

For the likes, I do not know how to get it. Sorry.

Regards, Dominic

Hi @Dominic Lagger , 

 

Thanks for the answer, i think i know the variable for likes.

 

One question is it all i need to include in Custom Macro?

 

Best,

Alex

Dominic Lagger Community Leader Aug 25, 2021

My full "No macro body" looks like this:

## Macro title: My Macro
## Macro has a body: Y or N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: My Name
## Date created: dd/mm/yyyy
## Installed by: My Name

## @noparams

#set( $page = $pageManager.getPage($content.getId()) )
Comments: $page.getComments().size()

Please share your code for the likes. I'm interessted into this.

Regards, Dominic

Thanks for the full code, comment count works, but we are still researching one for likes.

We tried likesManager.getlikes() but it didnt work. 

 

We will be working with Atlassian to find the solution and post it here once found!

Hey. Did you end up finding a solution with Atlassian?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.12.3
TAGS
Community showcase
Published in Confluence

Confluence: Where work and wellness meet

Feeling overwhelmed by the demands of work and life? With a 25% increase in the prevalence of anxiety and depression worldwide during the pandemic, for most of us, it’s a resounding yes . 🙋‍♀️ ...

757 views 5 21
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you