Skip to content

A minimalist commenting system on top of Cloudflare Workers KV

License

Notifications You must be signed in to change notification settings

antoinefink/simple-static-comments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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