comments.png Now with comments!

Introduction

As part of a class assignment, I got a little bit of time to work on a code project of my choosing.

I’d like to have comments on my site, but got frustrated at the crappy, javascript-heavy options. I also didn’t really want to pay $10/month for something that’s realistically not going to see a lot of use. My site is also a static site built in Hugo and there’s no magic build in comment support there either.

Cloudflare

This site is already hosted as a “Cloudflare Page” which is their awesome, effectively free (at my scale), CDN-backed hosting mechanism. A few weeks ago cloudflare announced that their D1 database product was now available (in alpha) to all customers.

I set about building a cloudflare plugin that can (sort of) easily be added to any site. I need to figure out more documentation on the exact process to deploy this, but you can check out the code at github.com/grahamsz/simple_cloudflare_comments.

Project Goals

I had a few requirements as I set out on this

  • Should be fast. I’m pretty obsessive about my site load times, and don’t want adding of a feature that most people won’t use to impact that significantly
  • Should support markdown. I ended up using Marked to handle the conversion to html
  • Should support pluggable authentication. Right now it only uses Google, but the backend uses Cloudflare Worker Auth Providers which should make it easy to add more choices
  • Should require very little javascript. I do use Javascript to inject the comments thread, but the deployed application requires none - it’s pure HTML/CSS
  • Should integrate WebMentions. Right now it does this by hitting webmention.io but I think it’d be a nice addition to capture those directly and store them in the D1 database alongside comments

Results

Scroll down, they should be right here. Hopefully!