It’s been a long time then I used WordPress for my personal blog and other projects. I learned a lot of WordPress ecosistem and, at the begginig, I liked the simplicity of their CMS. But, later, it started to come with very complex features in their releases from year to year which are not related for a simple blog page and I, at least, will never use them. Besides this, there are other concerns, like:

  • every code usually comes with bugs/exploits, and is my responsibility to maintain the host secure and I have no time for this headache.
  • spam spam spam… a lot of blog spam that you need a decent hosting solution - it’s money down the drain for me

After that I started looking on site generators which seems to solve a lot of my problems and also there is a lot of options to host my site on (github/gitlab/cloudflare/docker+nginx)

So I started digging deeper and I chose to play and use hugo

Since I don’t like to install apps on my pc, I will setup an environment to run hugo in docker. After some googling I found jojomi/docker-hugo which already have the boilerplate setup to start from.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
$ wget https://raw.githubusercontent.com/jojomi/docker-hugo/master/run.sh .
$ wget https://raw.githubusercontent.com/jojomi/docker-hugo/master/Dockerfile .

# build docker image
$ docker build -t myhugo .

$ docker run -it --rm \
    --name myhugo \
    --publish-all \
    -v $(pwd):/src \
    -v /tmp/hugo-build-output:/output \
    myhugo ash

inside docker container:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
$ hugo version
hugo v0.88.1-5BC54738+extended linux/amd64 BuildDate=2021-09-04T09:39:19Z VendorInfo=gohugoio

# create new site in root directory
$ hugo new site . --force

# install the theme
$ git clone https://github.com/xianmin/hugo-theme-jane.git --depth=1 themes/jane
$ cp -r themes/jane/exampleSite/content ./
$ cp themes/jane/exampleSite/config.toml ./

# exit from docker container
$ exit

in order to boot up hugo, I need a theme and after reviewing the hugo’s theme directory I choosed the jane theme.

After reviewing config.toml and make the changes in the main config file, I am ready to test it with docker-compose:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
version: '3.9'

services:
    hugo:
        container_name: myhugo
        build: .
        image: myhugo:latest
        volumes:
            - ./:/src
            - ./output/:/output
        environment:
            - HUGO_REFRESH_TIME=3600
            - HUGO_THEME=jane
            - HUGO_WATCH=1
        ports:
            - '1313:1313'
        restart: always
1
$ docker-compose up -d

and on http://localhost:1313 the new blog is up

Happy blogging