One “biggie” that was holding up this blog’s migration to a static site was getting a comments system up and running, followed by importing the existing comments. I had picked Isso a while back as it allows for easy import of existing comments from WordPress. I really didn’t want to depend on a third party comment hosting service like Disqus. I also didn’t want to use Staticman, mainly because it has dependencies on other services like Github or Gitlab. So Isso it was as that allows me to host everything on my own server.
Setting up Isso on FreeBSD
The Isso documentation recommends setting up Isso via virtualenv. As the server is only used as a web server (and I’m your typical “lazy” developer), I opted to ignore that part. This worked fine, the only hiccup I ran into was that the version of Isso I tried to install via pip had an API disagreement with the version of Werkzeug that it tried to install by default. That took a little time to figure out and I managed to resolve it by installing a specific version of Werkzeug (0.16.1):
pip install werkzeug==0.16.1.
Once that was out of the way, it was a simple matter of installing and configuring Isso following the documentation. I opted for the sub-URI configuration as that makes it easier to migrate to the server URL later. I’m not going to detail the configuration here - the Isso docs are good and it’s easy to configure.
Getting Hugo to play nicely with Isso
Ah yes, the fun part. I think I’ve mentioned before that I’m not really a web front end developer, so that took a little more figuring out. Fortunately the theme already has support for Disqus via the default Hugo integration, so between that, the Isso docs and the Staticman integration, I was able to figure this part out surprisingly quickly. In the end, it boiled down to adding another section to the site’s config.toml and adding the following code block to the theme’s layout/_default/comments.html:
The complete is here in my Github repository. I’m planning to clean up the change and submit it back to the original theme’s author. With the above change and some more debugging done, I had working comments. I had already imported an older version of the comments so I could quickly check that everything was working as expected.
As usual, all of this needs a bit more tweaking but it’s functional.
The section I ended up adding to the config.toml is in the [params] section and looks like this:
enabled = true data = "/isso" JsLocation = "/isso/js/embed.min.js" requireAuthor = true requireEmail = true replyNotification = false
What’s left to do?
To switch over from the current WordPress site to this one, not much. A server with a little bit more oomph, probably :). I also need to make sure that I can back up the comment database. That’s pretty easy and just a matter of rsync-ing the database file.
In the longer run, I still want to address some of the performance issues that Pagespeed Insights highlighted:
- The theme uses FontAwesome, which is, err, awesome. However that means that the initial page load requires about ~250kB of fonts, of which it’s only using a handful. It looks like it might be possible to reduce that font load by switching to SVGs.
- The theme also uses jQuery. As it supports fancybox, jQuery is pretty much a required dependency if you use fancybox. Which I don’t, so it would be nice to get rid of the jQuery dependency.
- Some general tweaks, mostly visual, but in general I’m pretty happy with the way the site looks now.
- Some sort of analytics. Google Analytics would be the easy button, but also looking into some of the other options that are self hosted (spot a theme here?). Right now I use goaccess for basic analytics.
All in all, I think I’m pretty close to switching over to the static site. I’ll probably give it a shot next weekend and see how things work out.
Note: Comments on the static site are still transient. I expect to do one last reload of the WordPress comments before I switch over, so comments only made on the static site will likely disappear. Sorry, the static site is still beta.