Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Counting comments on page without

Carl Jakob Schmidt November 18, 2021

Hello,

I am trying to find a way to count the comments on a page (the ones at the bottom as well as the inline comments) without using dedicated macros.

In my current situation, I only have a macro avaiable which requires the pageID as an input (the keywords $self or @self are not working) and returns a predefined table without the option for further customization.

I couldn't find the macro in the list of macros, so I guess it's a custom macro.

Also for this macro to work I would need to created the page including the pageID macro, obtain the pageID, edit the page, insert the custom macro with the pageID and save. Unfortunately this is not an option in the current situation.

 

I am not an administrator and have no access to e.g. the HTML marco.

 

Using Xpath in Chrome, I could count the comments by using

$x('//*[@id="page-comments"]/li').length

However I am not able to get this code (or its Jquery equivalent) to the page.

I tried using the Markup macro for that, but the code isn't rendered, because Confluence does not render the <script> tags for security reasons, if I am not mistaken.

 

So without being an admin and without having a dedicated HTML macro, how could I possibly count the comments on a page?

 

Your help would be really much appreciated =)

1 answer

1 accepted

0 votes
Answer accepted
Brant Schroeder
Community Champion
November 18, 2021

@Carl Jakob Schmidt Welcome to the Atlassian community

Have you considered working with your admin on a resolution to the issue?  If it is something you want to be displayed on the page I think that is the only way you will be able to work through this is with the admin.  If you just want to do a could occasionally then you could view the source and search "comment-" it would then give you the count.

Carl Jakob Schmidt November 20, 2021

Hi Brant,

thanks for welcoming me and replying so quickly. I will get in touch with my admin. I was just curious or hoped that there would also be another way to do that.

 

Best wishes
Carl

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events