Description
All the content on your website is great, but it’s even greater if you allow visitors to interact. That’s why we built the Comment Plugin to increase the engagement!
The plugin provides the API that allows users (logged-in and optionally also anonymous ones) to leave comments to your content.
Of course the plugin can be configured to require moderation of either all or only anonymous comments. When enabled, the moderator(s) will be notified via email when new comments are waiting for approval. The text of the email can be customized according to your needs.
Setup
-
Create a folder called
pluginsin your mesh directory if it does not exist yet -
Put the fat jar inside your
pluginsfolder -
Create the folders
plugins/comment,plugins/comment/storage/templates -
Create a file
plugins/comment/config.yml. See the configuration section for more details -
Create handlebars templates in your
storage/templatesfolder -
If you want the plugin to send mails, follow the steps in the mail template section
Configuration
Basics
All configuration fields can be set in the config.yml. Some fields
can can be overridden by other means. Here is the fallback order:
-
Referenced Field Config
-
Comment Section Node
-
Project Configuration
-
Configuration
-
Default values
These fields can be overridden per project: allowAnonymous,
requiresApproval, moderatorEmails, requiredForAnonymous,
commentRoot, nodeConfigField
These fields can be overridden per comment section and in the referenced
node: allowAnonymous, moderatorEmails, requiresApproval,
requiredForAnonymous
Fields
| Key | Type | Description | Default value |
|---|---|---|---|
|
uuid or webroot path |
Must point to a folder node. All nodes for the comment plugin will be stored under this node. |
REQUIRED |
|
array of strings |
Names of the projects for which this plugin is activated |
REQUIRED |
|
boolean |
Allows anonymous users to create comments |
|
|
boolean |
Created comments have to be approved by an admin to be shown in public |
|
|
array of strings |
Emails will be sent to these adresses. Leave empty to deactivate emails |
|
|
Array of |
These fields are required when anonymous users create comments |
|
|
object |
See above for details |
|
|
boolean |
Caches JS templates |
|
|
string |
See above for details |
|
|
object |
See below for example |
|
|
string |
Path to the folder of mail templates |
|
|
string |
Sender of mails |
|
|
map |
See example below |
See section
|
|
One of |
Resolves links for the referenced node in email templates |
|
Example File
commentRoot: "/comments"
projectNames:
- cmsdemo
requiredForAnonymous: [
"email", "author", "subject"
]
allowAnonymous: true
# Remove the following line for production. Default value is true
cacheTemplates: false
requiresApproval: true
nodeConfigField: commentConfig
moderatorEmails:
- moderator@example.com
mailTemplateFolder: plugins/comment/mailTemplates
mailServerConfig:
hostname: smtp.example.com
port: 25
starttls: REQUIRED
login: NONE
authMethods: null
username: null
password: null
ssl: false
trustAll: false
keyStore: null
keyStorePassword: null
ownHostname: null
maxPoolSize: 10
keepAlive: true
allowRcptErrors: false
mailSubjects:
commentCreated: "A test comment has been created"
mailSender: CMS Admin <cms@example.com>
Mail Templates
If you want the plugin to send mails, you have to provide mail templates as handlebar files. You can configure the folder of your templates in the configuration file. You must provide all template files or else sending mails will fail.
Available Templates
| Event | Filename | Description | Default subject | Available context variables |
|---|---|---|---|---|
Comment created |
|
Sent whenever a comment is created |
|
|
Context Variables
| Name | Description | Type |
|---|---|---|
|
Related comment |
Mesh node response |
|
Referenced node of the comment section |
Mesh node response |
