How to sort the comments on Confluence page in reverse order
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
How to reverse the order of comments on a Confluence page
Solution
⚠️ As this is a Customisation, please test it in your stage environment before implementing it into Production.
Go to Confluence Admin | Look & Feel | Custom HTML| Edit
Add the below lines under "At the end of the head" section
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<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
$('#comments-section-title').append('<a id="page-comments-reverse" href="#">(Reverse Order)</a>');
$('#page-comments-reverse')
.css({ 'color':'#999','font-size':'0.65em'})
.click(function (e) {
reverseCommentOrder();
e.preventDefault();
});
});
</script>
Click on Save
Before Adding the customization
After Adding the Customization
Was this helpful?