January 7, 2020
Blog migration to hugo
As I wrote some time ago, I decided to self-host blog. I'm in process still, however here's some experience.
Sharing here some experience in process (will update this post until done).
TL;DR:
Sharing here some experience in process (will update this post until done).
TL;DR:
- Install latest hugo with snap
- Find and install theme (with git submodule - see below)
- Try blog with "hugo server ..."
- Setup publishing pipeline on blog changes (for example, Jenkins or whatever is preferred).
- Install blogger_to_hugo migration tool
- (This one is not specific to anyone I suppose. I don't want to experiment with lots of new packages in my main macos system, so installing debian 9 as vbox VM. All further is done there).
- Run migration from blogger backup with blogger_to_hugo. I got an error:
TypeError: object of type 'NoneType' has no len()
Seems like it expects only the english post titles (or maybe texts in english too) and crashes otherwise. Too bad. - Use blog2md which produces a bunch of .md files (not sure about non-english titles, but no crash at least).
- Install and try to use zzo theme. It turns out that hugo 0.58 is not compatible. Although it's latest in debian sid (unstable) repo!
- Use snap installer (another repo to think of..): snap install hugo
- Hmm, zzo theme does still not work showing bunch of "render of 'page' failed..." errors and crashing in the end. Could be a non-english titles.
- Trying a hugo theme pure.
- Copy and edit config from example site of a chosen theme.
- Use git submodules for themes if your blog is in git (which itself is a great idea too!) like:
git submodule add https://github.com/SOME/THEME themes/THEME
- Use snap (it's in bad ones too) - to experiment only.
- TL;DR: always use system packages, do not install binaries.
I strongly advocate against using a zoo of repo managers (read: snap, pip, etc - whatever non-native to your OS updates subsystem) or binaries to anything running in runtime at server. It takes huge amount of maintenance to track of major updates. Most probably you would miss serious vulnerability at some point. Even old version of packages in debian stable receive security fixes (they are backported), which you would need to do yourself manually for any separate repo manager not added to your cron (most probably manually too). - Test your hugo+chosen theme with all desired charsets before everything else. It's really hard to believe that modern software written in golang crashes for a non-ascii (read: utf-8 or cp-1251), but that's what happens to hugo with some themes.
- Good old backslash escaping is not what works in yaml out of the box. To escape apostrophe (single quote) use '' (yes, type it twice). Enjoy this good reading before going bed (do not): https://yaml.org/spec/1.2/spec.html