Recent Comments

The {{ meerkat:recent_comments }} tag returns the newest published comments for the current site.

#Example

1<aside>
2 <h3>Latest comments</h3>
3 <ul>
4 {{ meerkat:recent_comments limit="5" }}
5 <li>
6 <a href="{{ thread:url }}#comment-{{ id }}">
7 <strong>{{ author_name }}</strong> on
8 {{ thread:title }}: {{ comment_text | truncate:100 }}
9 </a>
10 </li>
11 {{ /meerkat:recent_comments }}
12 </ul>
13</aside>
1<aside>
2 <h3>Latest comments</h3>
3 <ul>
4 <s-meerkat:recent_comments limit="5">
5 <li>
6 <a href="{{ $thread?->url() }}#comment-{{ $id }}">
7 <strong>{{ $author_name }}</strong> on
8 {{ $thread?->title }}: {{ \Illuminate\Support\Str::limit($comment_text, 100) }}
9 </a>
10 </li>
11 </s-meerkat:recent_comments>
12 </ul>
13</aside>

#Parameters

Parameter Default Notes
limit 5 Number of comments to return. Minimum: 1.
site / locale current site Restrict to one site. * includes all sites.

The tag returns published comments only. Use the moderation API for other states.

#Variables in the loop

Each comment contains its stored fields and custom comment_data, plus:

  • thread: the related entry, or null if the entry has been deleted

Calculated fields such as comment_html and current_user are available only in {{ meerkat:comments }}. See Comment variables.

Was this page helpful?