A little Pro magic required
This feature requires taking things to 11. Bring an active Statamic Pro license and you're good to go. See Statamic licensing
GraphQL
Meerkat adds public, read-only comment queries to Statamic's /graphql endpoint. It returns published comments without moderation data, author email addresses, or request metadata. Use the Control Panel or moderation API for private fields.
#Requirements
GraphQL requires Statamic Pro. Enable both GraphQL settings:
1MEERKAT_GRAPHQL_ENABLED=true
2STATAMIC_GRAPHQL_ENABLED=true
These settings are configured in config/meerkat.php, not the Control Panel.
#Queries
#meerkatThread
Thread details for one thread, found by thread ID or entry ID.
1{
2 meerkatThread(id: "blog/welcome") {
3 id
4 entry_id
5 title
6 comments_count
7 created_at
8 }
9}
A MeerkatThread also includes thread_id, site, collection, and updated_at. comments_count is the number of publicly visible comments. Pass entry_id instead of id to find the thread by its entry.
#meerkatComments
Paginated root comments for a thread, with each root's reply tree nested under replies.
1{
2 meerkatComments(thread_id: "blog/welcome", limit: 20, page: 1) {
3 data {
4 id
5 name
6 comment_html
7 created_at
8 replies {
9 id
10 name
11 comment_html
12 }
13 }
14 total
15 per_page
16 current_page
17 last_page
18 }
19}
Select a thread with thread_id or entry_id. Pagination uses limit and page, with defaults from meerkat.graphql.per_page and max_per_page.
#meerkatComment
A single comment, identified by its ID, with its reply tree. Returns null for a comment that is not public.
1{
2 meerkatComment(id: 42) {
3 id
4 comment_html
5 replies { id comment_html }
6 }
7}
#Comment fields
A MeerkatComment contains id, thread_id, parent_id, depth, replies_count, anchor, name, and gravatar. It also contains comment_text, comment_html, created_at, and replies. gravatar is a public Gravatar URL containing an MD5 hash of the commenter's email address. Omit it from queries if your privacy policy does not permit this identifier.
Fields from the comment blueprint are queryable automatically. The default blueprint supplies comment and website.
These custom fields become publicly queryable. When GraphQL is enabled, do not put private data in the comment blueprint, including moderation values or private profile fields.
#Caching
Statamic caches GraphQL responses through statamic.graphql.cache. Meerkat automatically clears this cache when comments change.