How to reverse the order of comments on Confluence pages
by David. Average Reading Time: about a minute.
From a recent comment on Atlassian Answers, Norman Hills asked “Is it possible to reverse the order in which comments appear?”
This is straightforward if done client-side, so I’ve written it up here.
If you just want to reverse the order for good, browse to Confluence Admin | Look & Feel | Custom HTML
Add this to At the end of the HEAD:
<script>
AJS.toInit(function(){
$comments = AJS.$('#page-comments');
$comments.children().each(function(i,li){$comments.prepend(li)});
});
</script>
Job done.
For extra points
If you want to be able to reverse the order, then it’s slightly more effort.
Browse to Confluence Admin | Look & Feel | Custom HTML
Add this to At the end of the HEAD:
<script>
function reverseCommentOrder(){
$comments = AJS.$('#page-comments');
$comments.children().each(function(i,li){$comments.prepend(li)});
}
AJS.toInit(function(){
// reverse the comment order
reverseCommentOrder();
// add a link to reverse the order
AJS.$('#comments-section-title').append('<a id="page-comments-reverse" href="#">(Reverse Order)</a>');
AJS.$('#page-comments-reverse').css({ 'color':'#999','font-size':'0.65em'})
.click(function(e){
reverseCommentOrder();
e.preventDefault();
});
});
</script>
That’s all. Have fun.

No comments on ‘How to reverse the order of comments on Confluence pages’
Leave a Reply