How to make this website

I am rebuilding this site. This site did not use Hugo’s theme functionality properly. Instead of using a theme folder and overriding it as necessary, I just had everything in one big monorepo. Applying patches from upstream themes became painful. It also made things difficult for people who wanted to copy my theme. To correct that, I am rebuilding the whole site, this time using with the theme and site in separate repositories, the way I should have in the first place. This post documents the process and serves to help people who may want to do something similar.

Creating the theme

To start, I create an empty git repository, with branches to track Munif Tanjim’s Minimo1 theme and achary’s Enigmo2 theme. Then I merge Minimo into master to start off with a fresh copy of it.

# Create the repo and push an initial commit
git init geronimo
cd geronimo
git add LICENSE
git commit -m "initial commit"

# Add a branch to track Minimo
git checkout -b minimo
git remote add minimo
git fetch minimo master
git branch --set-upstream-to=minimo/master

# Add a branch to track Enigmo
git checkout -b enigmo
git remote add enigmo
git fetch enigmo master
git branch --set-upstream-to=enigmo/master

# Finally, merge Minimo into the master branch and push it to the repo
git checkout master
git merge minimo/master --allow-unrelated-histories
git remote add origin [email protected]:brian/geronimo.git
git push --set-upstream origin master

Creating the site

After creating the base theme, I create a repository for the site itself.

# Create a Hugo site skeleton and initialize git tracking in it
hugo new site
git init
git add *
git commit -a -m "initial commit"

# Add the theme as a submodule
git submodule add themes/geronimo
git submodule update --init themes/geronimo

# Configure git large file storage
git lfs install
git config lfs. true

git remote add origin [email protected]:brian/
git push --set-upstream origin master

In the next commit, I use the default settings from the Minimo demonstration site’s config.toml to create a bare bones configuration. Instead of using a single config.toml, I use a config/_default directory with yaml files. The separate files are a bit more organized, and I dislike toml files.

Configuring automatic deployment

To test and deploy the site, I use Drone. The Drone script tests that the site builds without error, then send commands to the webserver to update it’s own copy and build it. /srv/www/sites/ is the git repository, and nginx is configured to serve the public directory within.

kind: "pipeline"
name: "default"

  - name: "fetch submodules"
    image: "alpine/git"
      - "git submodule update --init --recursive --remote"

  - name: "test"
    image: "plugins/hugo"
      hugo_version: "0.59.1"
      url: ""
      validate: true

  - name: "deploy"
    image: "appleboy/drone-ssh"
        from_secret: "ssh_host"
        from_secret: "ssh_user"
        from_secret: "ssh_key"
      timeout: 2m
      command_timeout: 10m
        - "cd /srv/www/sites/"
        - "git fetch --depth=1"
        - "git reset --hard origin/master"
        - "git submodule update --init --recursive --remote"
        - "hugo"
        - "master"
          - "pull_request"

The relevant nginx configuration when using the DebOps nginx role is quite simple. I could also have used the redirect_from key in the server entry, but I have some unlisted services running under the server.

  - name: ""
    ssl_crt: "/etc/letsencrypt/live/"
    ssl_key: "/etc/letsencrypt/live/"
    redirect: "$request_uri"
    redirect_ssl: "$request_uri"
    redirect_code: "301"
  - name: ""
    deny_hidden: false
    maintenance: false
    ssl_crt: "/etc/letsencrypt/live/"
    ssl_key: "/etc/letsencrypt/live/"

  1. “Minimo theme” Munif Tanjim GitHub [return]
  2. “Enigmo theme” achary GitHub [return]