Basic implementation of a NodeJS server for comments on a static website.
I didn't like any of the existing comment solutions for Jekyll, so wrote this one.
It's missing a lot of features compared to more robust solutions, but is very easy to set up and should get the job done for small sites.
- Multi-site support
- Threaded commenting
- Invisible reCaptcha v2
- Admin email notifications
- New comments
- Delete a comment via a link
- MySQL storage
Invisible reCaptchas are generated automatically, it's only necessary to add the site key and secret key to your configuration:
- Make sure the site key is included in
config.yml
- Make sure the secret key is included in
config.js
Set up reCaptcha site key and secret key at https://www.google.com/recaptcha/admin for your site.
- Clone the repository
- Use
comments.sql
to create the necessary database table for comments - Run
npm install
- Copy
config.example.js
toconfig.js
, edit to taste - Run
npm start
You should get a message Comments server listening on port...
.
This setup assumes a Jekyll static site.
For other configurations, you'll need to modify accordingly.
- Copy
templates/comments.html
andtemplates/comments-scripts.html
to the_includes
directory in the Jekyll install - Add
{% include comments.html %}
to any Jekyll templates where you want comments injected - If you're not already loading the recaptcha script by some other means add
{% include comments-scripts.html %}
to any Jekyll templates where you want comments injected - Copy
templates/comments.scss
into a Jekyll stylesheet if you'd like the default CSS styling - The frontend depends on jsrender, so load this script on any page where you want comments.
- Copy the settings in
_config.example.yml
to_config.yml
for the Jekyll site, and adjust as needed.
- Email alerts to users when a person replies to their comment
- Other database storage backends
Derived from original works: