As you may know, this blog is generated statically by the wonderful Pelican. By and large, this is fantastic. It's simpler, faster, easier to customize and more robust than running something like Wordpress. All the content lives in my git repository. It's just nice.
There's only one problem: comments. How do you allow people to comment on your posts without dynamically generated pages?
The “easy” way to have a static site and yet allow discussion is to use a third-party tool to do the dirty work for you, be it Disqus, Twitter, Google+ or something else. Some ‘external’ services that manage your comments in their own database are open source and can be self-hosted, like Isso and stacosys.
Automatically push comments ⇒ git
A possible middle ground is to give up some of the static-ness of your static site by employing a tool that dynamically pushes users' comments to a particular directory in your git repository, triggering a rebuild of your blog's pages. Staticman appears to do this to great effect. I really like the idea here, but there are some details that put me off:
- I don't want to rely on GitHub for my personal website, and Staticman is all about GitHub.
- I really like the idea of email verification of commenters as an anti-spam measure. It's like a login, which most websites require anyway if you want to comment – except I wouldn't want to impose Twitter or Google logins on my readers if I can avoid it.
- While I'm at it, I might as well allow users to edit their own comments.
So – I built my own variant of the idea! commie is a smallish flask app that takes people's comments, asks them to click a link in an email, and pushes things to my git repository. No API keys. No databases. No cookies. No third-party logins. Just emails, git, and comments. It's as simple as that. (If you want to use it for your own site you will need a server where you can run a Python 3.7 WSGI app, which might be a bit of a faff of course).
To display the comments in my Pelican site, I'm using the excellent Pelican Comment System, just without the bits that help you submit comments by email. Commie is in charge of the logistics, PCS of the presentation.
Try it out below!