npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

strapi-plugin-comment-manager

v1.0.17

Published

Strapi plugin to enable and manage comments for your content

Downloads

148

Readme

Strapi plugin Comment Manager

Enable and manage comments for your content very easily!

Video tutorial

Requirements

You should have installed an instance of Strapi v4.x.x

Installation

Run the following command in your project root:

npm install strapi-plugin-comment-manager

Configurarion

For your frontend to have access to the API, enable the following permissions for Comment Manager from Users & Permissions Plugin on your project settings:

For public, enable: count, find and getPageSize.

For authenticated, enable create on both Comment and Subcomment.

Display comments on the frontend

Comments can be displayed in the frontend in two ways:

  1. Using the React components library strapi-comments-client (recommended)
  2. Build your custom frontend using the API

API

There are some Typescript interfaces that will help to get an idea of the data structures.

Comments:

interface IComment {
  id: string;
  from_admin: boolean;
  createdAt: string;
  content: string;
  author: IAuthor | null;
  subcomments?: ISubcomment[];
}

Subcomments:

interface ISubcomment {
  id: string;
  from_admin: boolean;
  createdAt: string;
  content: string;
  author: IAuthor | null;
}

Authors:

interface IAuthor {
  username: string;
  email: string;
  id: string;
}

The following endpoints are exposed to fetch and post comments and subcomments:

Get comments for a content ID

Method: GET

Path: /api/comment-manager/comments/:slug

Optional query parameters: start, ignoreCount

Returns:

{
  commentsCount?: Number;
  comments: IComment[];
}

The parameter start indicates how many comments to skip. This is for pagination purposes.

The parameter ignoreCount indicates whether or not to return the total number of comments associated with the given slug.


Get the number of comments associated with a given content ID

Method: GET

Path: /api/comment-manager/comments/:slug/count

Returns:

{
  count: Number;
}

Post a comment

Method: POST

Path: /api/comment-manager/comments/:slug

Authentication: Bearer token

Payload:

{
  content: string;
}

Returns:

{
  id: Number;
}

Post a subcomment

Method: POST

Path: /api/comment-manager/subcomments/:parent-id

Authentication: Bearer token

Payload:

{
  content: string;
}

Returns:

{
  id: Number;
}

Get the page size

Method: GET

Path: /api/comment-manager/page-size

Returns:

{
  pageSize: Number;
}

General settings

The plugin allows to set how many comments are returned per page by going to the Pagination section under Comment Manager Plugin on the Settings section.

The default page size is 10.

Management of comments

Admin users are able to delete comments and subcomments as well as leave replies as admins from within the plugin page of the Strapi admin dashboard.

The plugin interface has two tabs: one for the latest comments and one for comments by content ID.

Submitting issues

Issues are submitted to https://github.com/luisguve/strapi-plugin-comment-manager/issues. Please provide as much information as possible about the bug or feature request.

Tutorial

For more detailed instructions on how to install, configure & use this plugin, check out this post.