Available from version 2.4 and up
An comments module adds discussion capabitilies to your wiki. It consists of properties that can be set by the user as well as methods that are called on certain events (e.g. posting a new comment).
Comments modules are located in /server/modules/comments
.
There're 2 supported formats for comments modules:
A unique folder is created for each module. The folder must contains these files:
This file contains information about your module.
key: example
title: Example Comments Provider
author: John Doe
logo: https://static.requarks.io/logo/example.svg
website: https://example.com/
codeTemplate: true
isAvailable: true
props:
firstExampleProperty: String
secondExampleProperty: Number
true
) or native (false
)This file contains the code snippets to inject into the head, body and comment slot.
main: |
<div id="external_thread"></div>
body: |
<script>
var something = remote()
</script>
This file contains methods that will be called on specific events.
// ------------------------------------
// Example Comments Provider
// ------------------------------------
module.exports = {
async create ({ pageId, replyTo, content, guestName, guestEmail, user }) {
// Code to create a comment here...
},
async update ({ id, content, user }) {
// Code to update a comment here...
},
async remove ({ id, user }) {
// Code to delete a comment here...
},
async count ({ pageId }) {
// Code to get the comment count for a page...
}
}
All methods are required and must be implemented.