Top Threads
The {{ meerkat:top_threads }} tag returns the most active threads by comment count.
#Example
1<aside>
2 <h3>Hot topics</h3>
3 <ul>
4 {{ meerkat:top_threads limit="5" }}
5 <li>
6 <a href="{{ thread:url }}">{{ thread:title }}</a>:
7 {{ comment_count }} comments
8 ({{ participant_count }} participants)
9 </li>
10 {{ /meerkat:top_threads }}
11 </ul>
12</aside>
1<aside>
2 <h3>Hot topics</h3>
3 <ul>
4 <s-meerkat:top_threads limit="5">
5 <li>
6 <a href="{{ $thread?->url() }}">{{ $thread?->title }}</a>:
7 {{ $comment_count }} comments
8 ({{ $participant_count }} participants)
9 </li>
10 </s-meerkat:top_threads>
11 </ul>
12</aside>
#Parameters
| Parameter | Default | Notes |
|---|---|---|
limit |
5 |
Number of threads to return. |
site / locale |
current site | Restrict to one site. * includes all sites. |
#Variables in the loop
Each result includes:
thread_id: the thread identifiercomment_count: publicly visible comments on this threadparticipant_count: number of distinct authorslast_activity: timestamp of the most recent commentthread: the matching Entry, ornullif a user deleted it
#Filtering by collection
The tag does not accept a collection parameter. To show counts for a collection, iterate its entries and call comment_count:
1{{ collection:blog }}
2 <article>
3 <h2>{{ title }}</h2>
4 <p>{{ meerkat:comment_count :thread="id" }} comments</p>
5 </article>
6{{ /collection:blog }}
1<s-collection:blog>
2 <article>
3 <h2>{{ $title }}</h2>
4 <p><s-meerkat:comment_count :thread="$id" /> comments</p>
5 </article>
6</s-collection:blog>
#Performance
For sites with large thread counts, cache the result at the template level:
1{{ cache for="1 hour" key="meerkat-top-threads" }}
2 {{ meerkat:top_threads limit="10" }}
3 ...
4 {{ /meerkat:top_threads }}
5{{ /cache }}
1<s-cache for="1 hour" key="meerkat-top-threads">
2 <s-meerkat:top_threads limit="10">
3 ...
4 </s-meerkat:top_threads>
5</s-cache>