dimisjim tech blog

Tips & Tricks by an engineer working on the Cloud

21 Jan 2021

Hugo Quickstart

About

This is a quick guide on how to quickly launch Hugo, with the hugo-ink theme, using docker-compose.

Procedure

  1. Your directory structure where you have placed your hugo content and code should be like this:

    your-hugo-site-directory
    ┣ content
    ┃ ┣ posts
    ┃ ┃ ┣ your-first-post.md
    ┃ ┃ ┗ your-second-post.md
    ┃ ┗ about.md
    ┣ themes
    ┃ ┗ ink
    ┣ config.toml
    ┗ docker-compose.yml
    
  2. You’ll need this docker-compose.yml:

    version: '3.5'
    services:
      hugo:
        image: klakegg/hugo:0.80.0
        container_name: hugo
        command: server --disableFastRender
        volumes:
          - ".:/src"
        ports:
          - "1313:1313"
    networks:
      default:
        name: hugo
    
  3. Run docker-compose up to launch hugo (and its server). I’ve chosen to use the –disableFastRender flag for the server command as it forces Hugo to rebuild for every change, not just for in the config.toml file