Wordpress to Hugo

The decision to move away from Wordpress was easy. It cost too much and the writing interface got in the way. Queue the discovery of static site generators. Hugo did what I needed and AWS S3 meant I didn’t have to run a server.

So what is Hugo?

Hugo is a static HTML and CSS website generator written in Go.

The biggest selling point for me was Hugo is single blob with no external dependencies.

Setup was easy. Old posts were converted to markdown files. Some content was cut but the old wordpress site is still available. Installation was super quick but there’s a few gotchas.

pkg install go
mkdir ~/go
echo 'export GOPATH=$HOME/go' > .zshrc
echo 'export PATH=$PATH:$GOPATH/bin' > .zshrc
go get -v github.com/spf13/hugo

With Hugo installed I simply created a new site directory and move my converted posts into $your-blog/content.

hugo new site your-blog
hugo new post/wordpress-to-hugo.md

Hugo doesn’t ship with a default theme so you’ll need to grab one before generating any content.

mkdir ~/your-blog/themes
cd ~/your-blog/themes
git clone https://github.com/crakjie/hugo-base-theme.git

You can serve Hugo sites locally or simply run the command to generate site content.

gibson% hugo server --theme=hugo-base-theme
Started building site
0 of 1 draft rendered
0 future content
10 pages created
0 non-page files copied
1 paginator pages created
7 categories created
7 tags created
in 60 ms
Watching for changes in /home/zerocool/your-site/{data,content,layouts,static,themes}
Serving pages from memory
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
^C
gibson%
gibson% hugo
Started building site
0 of 1 draft rendered
0 future content
10 pages created
0 non-page files copied
1 paginator pages created
7 categories created
7 tags created
in 65 ms

There’s various hosting options for static sites. I chose S3 because I’ve already got some AWS services.

Here are the steps to S3 serving static site content.

s3cmd put -P --recursive /home/zerocool/your-blog/public/ s3://your-site-url.com

Hugo works for me. The process of writing markdown using vim enjoyable and distraction free. The next challenge is automating the publishing process.