Static Comments allows you to have a comment section on your Pelican blog, while maintaining your blog as a completely static webpage and without relying on any external services or servers; just an email address is required. Comments are stored as text files, similiar in structure to Pelican articles. This gives you complete control over the comments appearing on your site and allows you to back them up with the rest of your site.
This release takes the existing Pelican Comment System codebase and upgrades it to work with Pelican 4 (and should continue to work with Pelican 3). A few changes are needed in your configuration, but no changes to your comments files should be needed.
The simplest way to install the Python code of Static Comments is to use
pip install minchin.pelican.plugins.static-comments --upgrade
If you are using Pelican 4.5+, the plugin will automatally be loaded (although not activated).
If you are an earlier version of Pelican, or non-namespace plugins, you will need to add the auto-loader to your list of plugins:
# pelicanconf.py PLUGINS = [ # others "minchin.pelican.plugins.autoloader", ]
Activate the plugin by adding the following line to your
# pelicanconf.py PELICAN_COMMENT_SYSTEM = True
and then set the email you want to receive comment emails at:
# pelicanconf.py PELICAN_COMMENT_SYSTEM_EMAIL_USER = "your.email" PELICAN_COMMENT_SYSTEM_EMAIL_DOMAIN = "gmail.com"
Finally, modify the
What A Comment File Looks Like
When a user submits a comment, you will get an email with the details. You then take those details from your email and create a text file within your Pelican site, one for each comment. By default, the plugin will look for comments in a folder
comments in your root content folder (probably the same one your have your Pelican articles in), and then in subfolders that match the slug of the article the comment applies to.
The actual comment file will look something like this:
email: firstname.lastname@example.org date: 2019-07-15T12:20+01:00 author: Mahassine replyto: comment-slug-2382md Sample comment body. <!-- content/comments/article-slug/comment-slug-2342.md -->
replyto tag is only needed if this comment is indeed a reply to another comment. The value of the
replyto tag is the slug of the comment, which is the filename plus the file extension, but not the period between them.
The comment files can be in any format Pelican is set up to read (typically Markdown and ReStructed Text, but many others supported).
I realize that this is fairly involved to activate as far as Pelican plugins go, so if you run into issues, please leave a comment on this post!
Upgrading (from the Pelican Comment System)
Upgrading from the Pelican Comment System should be seemless, and should be as simple as uninstalling the Pelican Comment System (and removing it from your
pelicanconf.py) and installing Static Comments.
pip uninstall pelican-comment-system pip install minchin.pelican.plugins.static-comments --upgrade
Existing comments files should work out of the box, and the setting haven’t been renamed.
- To get this to work, you’ll need to update your theme (or find one, like Seafoam, that works out of the box). I appologize for how involved this is, but Pelican doesn’t have any framework for editing themes from plugins.
- You have to manually add comments to your site, regenerate it, and reupload it before the comments will show on your site. This means that comments won’t immediately show, and the the workflow may not be feasible if you have a high comment volume.
- The documentation that is on the Github repo has been reviewed, but may still be out of date in places. Please let me know if you notice any issues there.
- If you are moving your site to Pelican from another system, importing your existing comments can be rather involved. There is an included script for Blogger comments that I used myself, but because such imports tend to be one-offs, these scripts don’t get checked that often and so could break if the export format changes. If you have a significant volume of comments you want to import, you may have to write your own script (which I’d be happy to include with the plugin if you send me a pull request!).
At this point, the plugin seems feature complete. I expect future changes will be about fixing code errors or to keep it working as Pelican progresses.
I’m excited to get this updated and out into the world. I’m a little sad that the old Pelican Comment System seems to be no longer being updated, although it looks like it got stuck halfway through a “version 2” complete rewrite, so add this as another warning about ground up rewrites. But this is the wonder of Open Source: I can take the existing codebase, fix the errors and issues, and release a new working version back into the world.
There is also a more general question of whether comments are worth keeping around. Considering that you’re reading this, and I released this plugin, I think we are both in agreement that the answer is “yes”. I have definitely seen a the number of comments posted to my blog drop over the years (this blog has been up since 2006!), but I suspect that is mostly tied to lower traffic volumes. As for comments generally, Twitter and Reddit I think provides proof that people still want to add their two cents on things, and personally, I would rather have the conversion here rather than on another site (like Reddit) that I don’t control and have the ability to backup that conversation.
Overall, I’m pretty satisfied with this solution. The biggest downside is that comments don’t post automatically and so can take some time to show as I have to manually post them, but I think that tradeoff is worth not having to maintain a separate server just for commenting.
As with all my plugins, if the pelican-plugins group wants to adopt these, I’d be happy to have the community support there.