Getting Started
Control Panel
Front End
Advanced
One thing to be aware of when building the templates is that Meerkat add-ons can "soft delete" a comment; this means that the comment will still exist. By default, Meerkat will not include these comments when using the {{ meerkat:responses }} tag.
To display soft deleted comments, we can supply a value of true
for the with_trashed
parameter:
1{{ meerkat:responses with_trashed="true" }} 2 {{ comments }} 3 <div class="media"> 4 <div class="media-body"> 5 <h4 class="media-heading">{{ author.name }}</h4> 6 {{ content }} 7 </div> 8 </div> 9 {{ /comments }}10{{ /meerkat:responses }}
We can react to this in our templates by checking the is_deleted
value:
1{{ meerkat:responses with_trashed="true" }} 2 {{ comments }} 3 <div class="media"> 4 <div class="media-body"> 5 <h4 class="media-heading">{{ author.name }}</h4> 6 {{ if is_deleted }} 7 <p>This comment was removed.</p> 8 {{ else }} 9 {{ content }}10 {{ /if }}11 </div>12 </div>13 {{ /comments }}14{{ /meerkat:responses }}
The previous example would show deleted comments; if those comments did not have any replies, it might look a bit odd with bunch of "This comment was removed" entries appearing. We can solve this by adding some extra conditional logic to only display deleted comments if they also have replies:
1{{ meerkat:responses with_trashed="true" }} 2 {{ comments }} 3 {{ if is_deleted == false || is_deleted && has_replies }} 4 <div class="media"> 5 <div class="media-body"> 6 <h4 class="media-heading">{{ author.name }}</h4> 7 {{ if is_deleted }} 8 <p>This comment was removed.</p> 9 {{ else }}10 {{ content }}11 {{ /if }}12 13 {{ if comments }}14 {{ *recursive comments* }}15 {{ /if }}16 </div>17 </div>18 {{ /if }}19 {{ /comments }}20{{ /meerkat:responses }}
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.