Skip to content

antoinefink/simple-static-comments

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

A minimalist free commenting system built with Cloudflare Workers using Workers KV

This commenting system is built to be as simple as possible. It consists of one endpoint and a couple of lines of inlined JS. It sits on top of Cloudflare Workers, which makes it free for the vast majority of blogs.

You can see it in action on my blog.

A single /comments endpoint is used:

  • POST requests create comments
  • GET requests retrieve all the comments for an article (using /comments/my-article-url).

If the ZAPIER_URL environment variable URL is set, all comments' data is sent to the webhook to, for example, help with moderation.

Getting started

Just add a wrangler.toml file and publish the worker. If you're new to this, check out:

To display the comments on any page, include a couple of lines of JS:

<script defer>
  fetch('https://example.com/comments/this-is-the-path-of-my-article')
    .then(response => {
        if (response.ok) {
          return response.text()
        } else {
          throw new Error('Something went wrong')
        }
      }).then(body => {
      document.getElementById("comments-list").innerHTML = body
    })
</script>

About

A minimalist commenting system on top of Cloudflare Workers KV

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published