@plumix/plugin-comments
v0.1.1
Published
Comments plugin for Plumix — threaded, moderated discussion on entries with a tested playground.
Maintainers
Readme
@plumix/plugin-comments
This Plumix plugin adds threaded, moderated comments to your entries — with a moderation queue, nesting, rate limiting, and email notifications.
Install
pnpm add @plumix/plugin-commentsThen add it to your plumix.config.ts and pick which entry types accept comments:
import { plumix } from "plumix";
import { comments } from "@plumix/plugin-comments";
export default plumix({
// …your runtime, database, and auth
plugins: [comments({ entryTypes: ["post"] })],
});The plugin ships a database table. Regenerate migrations after adding it:
plumix migrate generateWhat you get
- A
/commentsmoderation page (under Content) — approve, mark spam, or trash, gated behind acomment:moderatecapability. - Public endpoints —
POST /_plumix/comments/submitandGET /_plumix/comments/list, plus a{type}/{id}/commentsREST resource. - A
commentstemplate dependency your theme renders for the current entry. - Moderation hooks —
comment:moderate(trust policy) andcomment:created(notify).
Configuration
comments({
entryTypes: ["post"], // types that accept comments
mode: "first_time", // "all" | "first_time" | "none" — when to hold for review
maxDepth: 3, // reply nesting depth
rootsPerPage: 20, // roots per page
requireEmail: true, // require an author email
closeAfterDays: null, // auto-close threads after N days
notifyEmail: "[email protected]", // moderator address for pending comments
rateLimit: { max: 5, windowMin: 10 }, // per-author submission limit
});Notifications use the top-level mailer from your Plumix config.
Rendering in a theme
Load a thread without pulling in admin code via the /server entry:
import { loadThread } from "@plumix/plugin-comments/server";
const thread = await loadThread(ctx, { type: "post", id });Support
Have a question? Start a discussion. Found a bug? Open an issue.
Contributing
PRs and ideas welcome. The Contributing guide gets you set up — new contributors especially welcome.
License
MIT © Plumix Contributors
