This page looks best with JavaScript enabled

How to Deploy Hugo on Shared Hosting via Github

 ·  ☕ 2 min read  ·  ✍️ Brian M. Watson

Deploy Hugo on Github

This is connected to this other post, about Hugo!

When I decided that I wanted to use Hugo for my blog, I faced the question of “just how to I deploy this thing??”

While Jekyll what is easy to deploy (by simply using github desktop) Hugo was… not. They do have these very detailed yet very confusing set of instructions on their website, but they don’t help all that much.

As somebody in some forum pointed out, they’re written by developers for end-users, but not by end-users for end users. So a lot of specific steps are missing.

After much fucking around, I got it to work. Obviously. You’re reading it right now! As I could not find the following steps in one place, here are the three guides that made this possible:

Step 1

For Hugo I followed this guide updating the config.toml or the config.yaml and adding publishDir = "docs" deployed from the docs folder of the repository.

Step 1

[screenshot showing Visual Studio Code and the config.toml with the code above]

On Github you set the repository to deploy from docs:

Step 2

[Screenshot showing Github settings for the repository set to deploy from docs.]

That works and it deploys to: https://brimwats.github.io/musings/

Step 2

For Reclaim/Shared Hosting that uses cPanel I followed this guide

You do this by going to the ‘Zone Editor’ (don’t create a subdomain! this will cause the Zone editor to error out)

In the first field you put ‘subdomain.yoursite.com’. For me this was ‘musings.brimwats.com’.

The second box is not the full github URL. Instead it’s just ‘GitHubUsername.GitHub.io’ for me this was ‘brimwats.github.io’

Next, you follow this guide on GitHub and set the custom domain in the project to ‘subdomain.yoursite.com’. For me this was ‘musings.brimwats.com’.

Step 3

[screenshot showing “Custom Domain” in GitHub Settings set to appropiate domain]

Best of luck Hugo-ing, Victor!

Share on

Brian M. Watson
WRITTEN BY
Brian M. Watson
Archivist, Historian, Digital Humanist