Reverse the order in which comments appear Edited

I tried the scripts here: https://community.atlassian.com/t5/Confluence-questions/Is-it-possible-to-reverse-the-order-in-which-comments-appear/qaq-p/21425

 

But the thread is 5 years old and the scripts don't seem work on more recent versions (I am running 5.8.6)

 

When I put the code in the end of Head Custom HTML, the code appears at the top of every wiki page in an error state, and doesn't render.

2 answers

This widget could not be displayed.

That part of the answer worked perfectly on my instance 5.8.10

<script>
function reverseCommentOrder(){
  $comments = AJS.$('#page-comments'); 
  $comments.children().each(function(i,li){$comments.prepend(li)});
}

AJS.toInit(function(){

  reverseCommentOrder();
});
</script>

(I added the script tags self as you should do, otherwise the code will appear in the page). If that doesnt work, please provide the error state/error message

I was unable to locate the custom html file anywhere on my PC - searching for Confluence Admin yielded naught.  This is a client-side file, correct?  Where can I find it?

@Panos Perfect, I looked for something like this.

@Paul Willman No, you find it in the Confluence application:

Go as logged in user with admin permission to General Configuration > Look and Feel > Custom HTML

Click edit and add the Script at At end of the HEAD.

Cheers
Niklas

This widget could not be displayed.

We are not using html code, is there a way to do this without the code?

 

If I enter just this code, where do I put it?  

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

466 views 6 6
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you