New Blog for 2019

New Blog for 2019

I realised over the holiday period that I had not changed my blogging theme since 2009, and with the new year fast approaching it was high time to give it a spruce up.

I wanted to make sure the new blog was “mobile friendly” and have categories and recent post blocks, as well as pagination of all posts on the site.

As my HTML/CSS/JS skills are not particularly up to date, I turned to the excellent Hugo site generator, and used the Mainroad theme.

I’ve migrated most of my old content over to the new blog, and plan to keep adding new content in the coming months.

Live Editing with IPv6

As Hugo is a static site generator, you have to run a command to convert the raw markdown files that constitute the pages into static HTML files and assets for publishing.

One aspect of Hugo that I found particularly useful during the migration was the live editing feature, called Drafts Mode.

This feature allows you to run a local web server that automatically instructs your web browser to reload when you change one of the source files.

This makes checking how each new post looks very quick and easy, and avoids having to rebuild the site and refresh the page manually.

As I run IPv6 and develop on a remote server rather than locally, I need to tweak the Hugo Drafts command line to get the web server to listen on an external address.

Normally you would just run:

hugo server -D

However this would run the web server listening on http://localhost:1313/ (bind address 127.0.0.1).

Instead, to get it to listen on an external address, I ran it as follows:

hugo server -D --bind=0.0.0.0 -b dev.localdomain:1313

Which caused it to listen on //dev.localdomain:1313/ (bind address 0.0.0.0)

I then aliased this to hd to simplify the command to start the server:

/root/.bash_profile

alias hd='hugo server -D --bind=0.0.0.0 -b dev.localdomain:1313'

Be careful when using a wild card listener like this, as if you are using an external cloud server without a firewall, you may end up inadvertently publishing your draft site to the Internet.

For more info on Hugo, check out https://gohugo.io/