Recently migrated this very site from WordPress to Hugo. Although I didn’t have many major complaints with WordPress I found it too heavy for my needs. In essence I’m just looking for a bunch of text posts that can be added and updated.

There’s a dozen of plain text / markdown blogging platforms, Jekyll and Bear spring to mind but I settled on Hugo for no reason in particular. I know a little bit of Go so changing the themes and layout isn’t too much hassle.

Hugo has a nice hot-reloading previewer that mostly works. I’ve found it occasionally doesn’t pick up changes and has to be restarted, doesn’t take a second though.

The simplification of the framework is a pro and con. Pro that anything can be made with effort, the layout, styling, additional variables and configuration are all within reach. However this requires a lot of digging in the code and isn’t reasonably suitable for someone less technically proficient.

Editing

Hugo posts simply consist of markdown files, so editing is a breeze and can be done in any editor.

Because of the standardisation of markdown files, moving them to another hosting platform should be very simple. WordPress had all sorts of specific formatting I had to strip out to get the raw post data.

There’s a little more admin required, manually setting modification dates and needing to create files in the correct folders, but nothing much more.

The files are all hosted on a private GitHub repo for syncing betweeen machines (and also for deploying as I’ll get onto). This also means I can edit files in the GitHub dev workspaces editor if need be.

Theming

The theme is mostly PaperMod with some slight modifications to merge the “profile” and “home” views. I liked the profile layout with the avatar and social links but also wanted the blogroll. Also made some tiny modifications to how images are auto-resized.

You can find my modifications here, they’re used as a Git submodule.

Deployment

Deployment of the site from the GitHub repo takes the form of a GitHub action that uses rclone to upload the built site on every push. Originally tried using rsync but my hosting provider Hetzner doesn’t provide SSH access at the level I’m on, so had to use something that directly uploaded using SFTP.

Here’s the entire GitHub action. It uses 2 secrets, RCLONE_CONF which is the entire rclone configuration file, and DEPLOY_PATH which points at the public_html folder.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Hugo

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout Code
        uses: actions/checkout@v3
        with:
          submodules: true

      - name: Install Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: '0.134.3'
          extended: true

      - name: Build Website
        run: hugo --minify
        
      - name: rclone
        uses: wei/rclone@v1
        env:
          RCLONE_CONF: ${{ secrets.RCLONE_CONF }}
        with:
          args: sync ./public remote:${{ secrets.DEPLOY_PATH }}