Pythonity Blog Pythonity Blog

Static Sites and Comments. Wait, What?

Static sites don't really go together with comments. Because... how? Comments are dynamic by their nature. The whole point of a static site generator is to not have a web application running that renders content on request, and instead do the rendering/generating only when something's changed. Comments don't really fit into that logic. But, let's say you want them anyway. Or let's say your boss wants them on this very blog. (And you're thankful at least he doesn't want them in a modal window with animated graphics around.)

A little big of Googling, and it seems that all is good in the world - a static comments Pelican plugin, somebody already did what I'm trying to do. Awesome. The catch is that the approach is really... unique. The solution described in Static comments via email by Bernhard Scheirle, instead of adding a comment, sends you an email with the contents, that you then have to (semi-manually?) add to your repository and regenerate the site. Moderation is therefore built-in! :-) It's fully static, no doubt about it, but the more I thought about the idea, the less I liked it. Because to be considered usable in my (and, more importantly, my bosses) opinion, we would need to create a separate email inbox, and a parsing script that would read new emails, add them to the appropriate new comments subfolder and regenerate the site. Doable, but seems like more hassle then it should be.

Maybe Disqus then, a solution that's popular across the Internet, for both static and non-static sites? Yeah, that's what I proposed too, but my boss wouldn't allow it. No shady third party service shall have our data!, he said. They help advertisers target you based on the comments you leave!. Well, fair enough. Perl is a great programming language!, he added, and that's when I knew I don't stand a chance here. And after reading a couple of articles, he was kinda right (obviously I didn't tell him that). So let's find something else.

You would've thought that there are multiple options, especially for a fairly popular application like Pelican, but that's not really the case here. Pelican plugins repository has only Google Plus, Disqus, the already mentioned static comments via email solution, and a fully manual comment plugins. Is that it?

Fortunately, no. I took 'pelican' out of the equation and found Isso, which had me right from the start with the awesome xkcd comic on the front page. Written in Python, with SQLite as its simple database backend and integration via a couple lines of code. What's not to like? OK, it's not really static, but as we agreed comments by design can't be truly static. What it is though is really awesome. Did I mention the xkcd comic?

xkcd comic

(this one)

The documentation is plain and simple, and installation shouldn't be a problem, especially if you already managed to configure Pelican (or any other static site generator for that matter). Writing a straightforward configuration file, running the isso web app in the background, letting your webserver know where to look for it and adding the HTML/JS code is all you need to do.

With that, we've reached the end, and there's only one thing left to say: any comments?

Comments