Getting Started
Control Panel
Front End
Advanced
Meerkat provides a wide range of default values you can use to build your comment threads in addition to any custom values specified in your blueprint. In addition to the default variables and blueprint values, Meerkat addons can also provide additional values.
The following table lists all of the variables that Meerkat provides your templates:
Variable | Description |
---|---|
{{ internal_content_truncated }} | A boolean value indicating if Meerkat forcefully truncated the comment's content. |
{{ id }} | The comment's string identifier. |
{{ email }} | The author's email address. |
{{ user_agent }} | The author's user agent string. |
{{ referer }} | The author's referer header string. |
{{ user_ip }} | The author's IP address string. |
{{ internal_path }} | The comment's internal (or virtualized) storage path; may contain sensitive system details. |
{{ comment_raw }} | The comment's raw content, without any processing. |
{{ comment_date }} | A DateTime instance representing the UTC date/time the comment was submitted. |
{{ comment_date_formatted }} | A string representation of the UTC date/time the comment was submitted; formatted using a configured value. |
{{ is_root }} | A boolean value indicating if the comment is a root level comment, or has a depth of 1 . |
{{ is_parent }} | A boolean value indicating if the comment is a parent comment. |
{{ has_replies }} | A boolean value indicating if the comment has any replies that can be rendered. |
{{ ancestors }} | A list of all ancestor comment identifiers. |
{{ descendants }} | A list of all descendant comment identifiers. |
{{ internal_root }} | The furthest descendant identifier this comment belongs to; will match id if comment is of depth 1 . |
{{ depth }} | The comment's depth in the hierarchy structure. |
{{ children }} | A list of all direct replies. |
{{ comments }} | A list of all direct replies; this variable is renamed if the current scope is renamed. |
{{ is_reply }} | A boolean value indicating if this comment is a reply to another comment. |
{{ revision_count }} | The current number of revisions for this comment if change tracking is enabled. |
{{ content }} | The comment's content. |
{{ author }} | A list of the comment's author information. |
{{ internal_parent_author }} | A list of the parent comment's author information if this comment is a reply, or null . |
The is_parent
and has_replies
variables are similar, but behave slightly differently. If there are active filters that effectively remove all of a parent comment's replies, the has_replies
variable will evaluate to false
, but the is_parent
variable will remain as true
.
By default, Meerkat provides an author
array and an internal_parent_author
array (if the comment is a reply). These arrays will contain the following additional information:
Variable | Description |
---|---|
{{ id }} | The author's identifier, or null . |
{{ email }} | The author's email address. |
{{ user_agent }} | The author's user agent string. |
{{ user_ip }} | The author's IP address string. |
{{ has_user }} | A boolean value indicating if the author can be mapped to a site user. |
{{ url }} | A string value of the author's website, if the blueprint supports it. |
{{ permissions }} | A list of the user's resolved permissions. |
Important Notice About Author Identifiers
Always check the has_user
value before attempting to locate the corresponding Statamic user.
Each comment author array (author
or internal_parent_author
) contains an array permissions
containing all of the resolved permissions for the user. Anonymous authors will also have a permissions
array, with all permissions set to false
. The following table lists all of the permission variables you have access to:
Variable | Description |
---|---|
{{ can_view_comments }} | A boolean value indicating if the user has the View Comments permission. |
{{ can_approve_comments }} | A boolean value indicating if the user has the Can Approve Comments permission. |
{{ can_unapprove_comments }} | A boolean value indicating if the user has the Can Unapprove Comments permission. |
{{ can_reply_to_comments }} | A boolean value indicating if the user has the Can Reply to Comments permission. |
{{ can_edit_comments }} | A boolean value indicating if the user has the Can Edit Comments permission. |
{{ can_report_as_spam }} | A boolean value indicating if the user has the Report Comment as Spam permission. |
{{ can_report_as_ham }} | A boolean value indicating if the user has the Report Comment as Not Spam permission. |
{{ can_remove_comments }} | A boolean value indicating if the user has the Can Delete Comments permission. |
Permissions are primarily enforced through the usage of the Statamic Control Panel, but are provided so that you can react to them if required in your project's design.
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.