Template Overview

Use the {{ meerkat }} Antlers tag to render forms, comments, and thread data. The main comments tag returns more fields than the site-wide helpers.

#Tag methods

Tag Purpose
{{ meerkat:form }} Render the submission form for the current thread.
{{ meerkat:comments }} Return published comments for the current thread, with replies in {{ children }}.
{{ meerkat:comment_count }} Number of comments on the current thread.
{{ meerkat:comments_enabled }} Whether the current thread accepts submissions.
{{ meerkat:replies_to }} Load the optional inline-reply script.
{{ meerkat:recent_comments }} Newest comments across all threads (for sidebars).
{{ meerkat:top_threads }} Most active threads.
{{ meerkat:author_history }} One author's comment history.
{{ meerkat:thread_stats }} Public counts or moderator-only counts for the current thread.
{{ meerkat:success }} Submission feedback stored in the session.
{{ meerkat:errors }} Submission errors stored in the meerkat error bag.
{{ meerkat:debug }} Show which thread the tags use during local development.

#How Meerkat finds the thread

Unless you specify a thread, Meerkat finds one from the current entry. It checks these values in order:

  1. thread="..." parameter: if present, use it directly (either a thread ID or an entry ID).
  2. from_thread="..." parameter: alias for thread.
  3. meerkat_share_comments context variable: set this in an Antlers layout to share a thread across templates.
  4. The id context variable: typically the current page's entry ID.
  5. The page object: typically the current entry.

If none point to a known thread or entry, the tag returns an empty result.

{{ meerkat:comments }} and {{ meerkat:comment_count }} also accept several thread IDs separated by a pipe (thread="a|b"), or thread="*" for every thread. See Displaying comments: Querying multiple threads. The other tags accept one thread.

#Comment variables

{{ meerkat:comments }} returns stored fields, custom blueprint fields, and calculated values. Render only the fields your template needs.

{{ meerkat:recent_comments }} and {{ meerkat:author_history }} omit calculated values. recent_comments also returns the related thread entry.

#Body

  • id: comment ID
  • comment: raw text the commenter typed
  • comment_html: the comment text rendered through Meerkat's sanitizing Markdown renderer (safe to output unescaped)

#Author

  • author_name: displayed name (signed-in user's name, then the submitted guest name, then the configured anonymous name)
  • author_email: email selected in the same order
  • author: the Statamic User ID for authenticated commenters, or null for guests. Available in {{ meerkat:comments }} (not in recent_comments / author_history).
  • name / email: compatibility aliases. Use author_name / author_email in templates.
  • gravatar: Gravatar URL derived from an MD5 hash of the selected email address.

#Threading

  • parent_id: ID of the parent comment, or null for roots
  • depth: 0-based nesting depth
  • path: dotted hierarchy path (1.2.3 style, the ancestor chain)
  • replies_count: number of direct published replies
  • is_root: true if parent_id is null
  • is_reply: true if the comment has a parent_id
  • has_replies: true if children is non-empty
  • is_deleted: true if soft-deleted. Appears only when the parent tag has include_trashed="true".
  • is_removed: true for a moderation tombstone
  • children: nested list of replies
  • anchor: comment-{id}
  • permalink: #comment-{id}

#Moderation state

  • is_published: boolean
  • moderation_status: approved / pending / rejected / spam
  • is_spam, is_ham, checked_for_spam: finer-grained spam state
  • moderation_reason: short string set when rejected
  • moderation_notes: longer admin notes
  • moderated_by: actor ID
  • moderated_at: Carbon

Visitors cannot query unpublished, spam, or removed comments. Templates can still access moderation fields, so do not print the complete comment data in HTML or client-side JSON.

#Timestamps

  • created_at: Carbon, when the user submitted the comment
  • published_at: Carbon, when Meerkat published the comment
  • last_activity_at: Carbon, activity timestamp maintained on the comment and its direct parent

#current_user block

Every comment includes a current_user.* block for the person viewing the page:

Key Description
current_user.is_authenticated The viewer is signed in as a Statamic user.
current_user.is_author The signed-in user is the author of this comment.
current_user.can_edit Can moderate this comment's collection/site and has edit comments.
current_user.can_delete Can moderate this comment's collection/site and has delete comments.
current_user.can_reply The viewer may submit, reply depth allows another level, and the target entry is not explicitly or automatically closed.
current_user.can_report_spam Can moderate this comment's collection/site and has report comment spam.

For front-end edit links, check is_author and can_edit:

1{{ if current_user:is_author or current_user:can_edit }}
2 <a href="...">Edit</a>
3{{ /if }}
1@if ($current_user['is_author'] || $current_user['can_edit'])
2 <a href="...">Edit</a>
3@endif

Meerkat does not provide front-end edit or delete URLs.

#Request metadata

When enabled in meerkat.privacy, front-end submissions record:

  • user_ip: string (IPv4 or IPv6)
  • user_agent: string (truncated to 1024 chars)
  • referer: string (truncated to 1024 chars)

Do not display or return these values publicly. Anonymous API responses, recent_comments, and author_history omit them.

#Common filtering and sorting

{{ meerkat:comments }} supports Statamic conditions and sorting:

1{{ meerkat:comments is_spam:is="false" comment_text:contains="hello" order_by="created_at:asc" }}
1<s-meerkat:comments is_spam:is="false" comment_text:contains="hello" order_by="created_at:asc" />

Use field:operator="value". Supported operators are is, isnt, contains, does_not_contain, exists, doesnt_exist, in, not_in, greater_than, and less_than. See Statamic's collection filtering documentation.

Was this page helpful?