To show a post's comment count in an index or list view, simply add the following HTML where you want to show the count:
<span data-cove-count-comments="{{id}}"></span>
This must be added within the {{#post}}
and {{/post}}
tags.
Adding this will display something like 3 comments
in your theme.
Make sure your Cove Javascript file is set up correctly
For comment counts to work, you may need to make a change to your Cove Javascript tag.
If you installed Cove before early October 2021, your Javascript tag will look like this:
<script src="https://cdn.cove.chat/comments.js" async></script>
This needs to be changed to match the new default, which should include your publication's Cove ID, like this:
<script src="https://cdn.cove.chat/comments.js" data-cove-id="add_your_cove_id_here" async></script>
You can find your Cove ID on the Install page in Cove.
Customisation
Change language or text
You can easily change the "comments" text that's displayed on the page.
You have the option to replace "comment" (if there is only one comment) and "comments":
<span data-cove-count-comments="{{id}}" data-translate-comment="comentario" data-translate-comments="comentarios"></span>
This example will display 1 comentario
or 3 comentarios
on the page.
Only show the number
You may just want to show the number, like this:
To do this, use this code:
<span data-cove-count-comments="{{id}}" data-translate-comment="" data-translate-comments=""></span>
This will display just 1
or 3
on the page.