Finally: comments!

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.

The most authentic way to have comments in a static site is to ask people to email them in, possibly with some JavaScript support, and add them to your git repository by hand. In this scenario, you stick with full static generation: the comments live in your repository, next to your content. This is what Bernhard Scheirle does with his Pelican Comment System.

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:

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!


Comment Atom Feed

Add a Comment

You will receive an email asking you to confirm your comment. Your email address will not be published. Your email address will be deleted after two weeks, unless I choose to contact you directly before then.

You can use Markdown (no HTML) syntax to format your comment.