i’ve had the idea for introducing a comment system to this blog for a while now, and i’ve finally gotten around to building it!
this is the first step towards making this blog more of a two-way conversation; i don’t think many people actually read this blog, but i’d like to think that if someone does, they can leave a comment and i can respond.
the system works like this:
- select text on any entry page – a small popover appears
- write a comment – add your name, optional email, and thoughts on that specific passage
- moderation – i get an email with approve/reject links
- approved annotations are anchored to the original text using fuzzy matching, so they stay attached even if the text shifts slightly
- sidebar – all annotations for a page are listed below the content
technically, it’s built on a Cloudflare Worker with a Durable Object for storage:
workers/annotations/
wrangler.jsonc -- worker config, DO binding, route
src/index.js -- API: POST to create, GET to fetch, approve/reject links
static/js/annotations.js -- client: text selection popover, fuzzy anchoring, sidebar render
static/css/annotations.css -- styling for popover, marks, sidebar items
go ahead and try it out! select some text on this page and see what happens.