This site is an example of how a Jamstack site can implement comments.
All comments are posted with a form and once approved, rendered directly onto the site via a build. No JavaScript is required to pull them into your browser for rendering.
The site is a living example and you can try commenting on the pages listed on the home page. (The site owner will get a notification of your comment via Slack, and will need to approve your comment before it shows up, so be patient).
How do the comments work?
Rather than using a third party comments service which might inject comments (and other things?!) into your site using JavaScript, this approach uses traditional http form posts and continuous integration to automatically build your comments directly into your site.
The flow goes like this:
A user submits a comment to the comments queue form on your page. That form posts to the form handling facility in Netlify where the site is hosted.
The form submission triggers a call to a Lambda function which passes the details of the comment along to Slack where a site administrator can review the comment, and click a button to accept or reject the comment.
Rejected comments get deleted from the comment queue
Accepted comments get posted into the approved comments form, which automatically triggers a build and deployment of the site. Accepted comments are also deleted from the queue.
The site build pulls all the approved comments from the Netlify submissions API, and then generates all of the pages (complete with their comments) with a static site generator (the simple and elegant 11ty)
See the moderation in action
Want one of your own?
You can get your own instance of this example site up and running on Netlify very quickly by clicking the button below.
Wait, what happens when I click that button?
Good question. Here's what it will do...
We'll clone the git repository of this project into your Github account. We'll be asking for permission to add the repo for you.
We'll create a new site for you in Netlify, and configure it to use your shiny new repo. Right away you'll be able to deploy changes simply by pushing changes to your repo.
You'll need to do a little config in order to integrate with Slack etc. There are some instructions to help get you set up