Meerkat

Meerkat

Sorting Comment Threads

Meerkat 2 has tossed away the sorting system from previous versions of Meerkat and replaced it with a new, more powerful system. The syntax for sorting comments is different from previous versions, but the capabilities it unlocks are worth it.

By default Meerkat will sort comments by their id in descending order (internally, Meerkat comment identifiers are the UNIX timestamp of when they were submitted).

#Ordering Comments

To specify a custom sort order, we can use the orderby parameter in the {{ meerkat:responses }} tag:

1{{ meerkat:responses orderby="id,desc" }}
2 
3{{ comments }}
4 <!-- Render the comment thread here. -->
5{{ /comments }}
6 
7{{ /meerkat:responses }}

The syntax for specifying sort order is:

1<PROPERTY_NAME>,<DIRECTION>

The following directions are available:

Variable Description
asc Sorts the property in ascending order (smallest to biggest).
desc Sorts the property in descending order (biggest to smallest).

The property name and direction are always required.

#Ordering by Multiple Properties

Multiple sort orders can be applied to a single comment thread by chaining sort orders with the pipe (|) character. The following example demonstrates how to first sort by newest comments, and then by the contents of the comment:

1{{ meerkat:responses orderby="id,desc|content,asc" }}
2 
3{{ comments }}
4 <!-- Render the comment thread here. -->
5{{ /comments }}
6 
7{{ /meerkat:responses }}

#Available Orderable Parameters

There are many variables that can be used when sorting comment threads; please consult the Default Variables article for information about which properties are available. Compound properties may not be currently supported (i.e., internal_reply_author.name).

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.